示例#1
0
    // Update is called once per frame
    void Update()
    {
        transform.rotation = Quaternion.Euler(new Vector3(0, 0, getAngleHeading(rd.velocity)));

        //checks if below threshold
        if (isBelow())
        {
            Destroy();
            return;
        }

        //checks if hitting player
        if (isHitPlayer())
        {
            player.damage(damage);
            Destroy();
            return;
        }

        EnemyMovement enemy;

        //checks if hitting enemy
        if (isHitEnemy(out enemy))
        {
            enemy.damage(damage);
            Destroy();
            return;
        }
    }