Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (enemyFlag)
     {
         frameCount += 1f;
         if (frameCount > targetFrame && enemyFlag)
         {
             anim.Play(act.GetName(), 0);
             enemyFlag = false;
         }
     }
 }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject.tag == "Enemy")
        {
            float[,] enemyArea = EnemyArea(collider.gameObject.transform.position.x, collider.gameObject.transform.position.y, 3f, 0.5f);
            float[] disList = new float[actions.Count];
            int     i       = 0;
            foreach (ActPosition1 a in actions)
            {
                disList[i] = a.AreaChecker(enemyArea);
                i++;
            }
            act       = actions[maxIndex(disList)];
            enemyFlag = true;
            Demo1enemy enemy = collider.gameObject.GetComponent <Demo1enemy>();
            Debug.Log(enemy.speed);
            float enemyFrame = (collider.gameObject.transform.position.z - 0.15f - this.gameObject.transform.position.z) / enemy.speed;
            targetFrame = enemyFrame - act.GetFrame();

            Debug.Log(act.GetName());
            Debug.Log(act.GetFrame());
            act.DebugSphere();
        }
    }