示例#1
0
 public void AntDied(Anthill anthill)
 {
     if (anthill.gameObject.tag == "Player")
     {
         Points -= 50;
     }
 }
示例#2
0
 public void CollectApple(Anthill anthill)
 {
     if (anthill.gameObject.tag == "Player")
     {
         Points += 100;
     }
 }
示例#3
0
 public void CollectSugar(Anthill anthill)
 {
     if (anthill.gameObject.tag == "Player")
     {
         Points += 1;
     }
 }
示例#4
0
 public void Initialize(Anthill anthill, GameManager gameManager, string scriptName)
 {
     _state       = State.Idle;
     _anthill     = anthill;
     _gameManager = gameManager;
     _nearSugar   = new List <Sugar>();
     _nearApples  = new List <Apple>();
     _antScript   = new AntScript(this, scriptName);
 }
示例#5
0
        private void SpawnAnts(Anthill anthill)
        {
            const int   antCount = 20;
            const float radius   = 6f;

            for (var i = 0; i < antCount; i++)
            {
                var angle  = i * 360 / antCount;
                var offset = Quaternion.Euler(0f, angle, 0f) * Vector3.forward * radius;
                var obj    = Instantiate(AntPrefab);
                obj.transform.parent   = anthill.AntContainer;
                obj.transform.position = offset + anthill.transform.position;
                obj.transform.rotation = Quaternion.LookRotation(offset);
                obj.name = string.Format("ant {0}", _antNumber++);
                var ant = obj.GetComponent <Ant>();
                ant.Initialize(anthill, this, _parameters.AntScriptName);
            }
        }
示例#6
0
 public void Reach(Anthill anthill)
 {
     CallLuaFunction(reachAnthill);
 }