MWS/voxelSpace/Assets/Scripts/Ant.cs
2021-09-16 19:42:18 +02:00

34 lines
833 B
C#

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);
}
}