示例#1
0
    protected void Start()
    {
        // this is just used to instantiate the health of the evil cat (class with static methods) as soon as the evil cat itself is instatiated
        evilHealth = EvilHealth.Instance;

        this.gameObject.AddComponent<EvilHealthDisplay>();
        healthDisplay = this.GetComponent<EvilHealthDisplay>();

        this.gameObject.AddComponent<MoveCat>();
        move = this.GetComponent<MoveCat>();
        move.AddVectorsToList ();

        this.gameObject.AddComponent<EvilBasicFire>();
        fire = this.GetComponent<EvilBasicFire>();
         		fire.ShootAtPlayer ();
    }
示例#2
0
    public void MoveCatToNewPosition(EvilBasicFire fire)
    {
        IncrementTimer ();
        //lerp!
        float perc = currentLerpTime / lerpTime;

        var newPosition = Vector3.Lerp (startPos, endPos, perc);
        transform.position = newPosition;

        if (transform.position == newPosition && !fire.HasShot) {
            fire.ShootAtPlayer ();
            fire.HasShot = true;
            hasMoved = false;
        }
    }