MWS_2021/voxelSpace/Assets/Scripts/Ant.cs

34 lines
833 B
C#
Raw Normal View History

2021-05-07 14:05:50 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ant : MonoBehaviour
{
// Start is called before the first frame update
public bool hasFood = false;
public sbyte foodSearch = -1; // 1 it has food, -1 it searches for food
public VoxelSpace voxelSpace;
public void sniff()
{
//zadanie 2.3
go();
}
void turnVerticaly() // /\ \/
{
gameObject.transform.rotation = Quaternion.Euler(0,90*(foodSearch*-1.0f)-90, 0);
}
void turnHorizontaly() // <-->
{
gameObject.transform.rotation = Quaternion.Euler(0,90*(foodSearch*-1.0f),0);
}
public void go()
{
gameObject.transform.position += gameObject.transform.forward * (1.0f/voxelSpace.animationFrames);
}
}