Exemplo n.º 1
0
    // Use this for initialization
    void Awake()
    {
        //	Debug.Log(transform.position);

        rigidbody = GetComponent <Rigidbody2D>();

        if (GameObject.FindGameObjectWithTag("Player"))
        {
            player = GameObject.FindGameObjectWithTag("Player").GetComponent <ShootingPlayerBase> ();
        }
        else
        {
            direction = isPlayer ? 0 : 180;
            if (isSideScroll)
            {
                direction -= 90;
            }
            transform.localRotation = Quaternion.AngleAxis(direction, new Vector3(0, 0, 1));
        }
        if (!isLookPlayer)
        {
            direction = isPlayer ? 0 : 180;
            if (isSideScroll)
            {
                direction -= 90;
            }
            transform.localRotation = Quaternion.AngleAxis(direction, new Vector3(0, 0, 1));
        }
        else
        {
            AimPlayer(transform.position);
        }
    }
Exemplo n.º 2
0
 // Use this for initialization
 protected override void Init()
 {
     spanEv = new TickEvent(span);
     spanEv.SetFunction(Shot);
     if (GameObject.FindGameObjectWithTag("Player"))
     {
         player = GameObject.FindGameObjectWithTag("Player").GetComponent <ShootingPlayerBase>();
     }
 }
Exemplo n.º 3
0
 void OnTriggerEnter2D(Collider2D c)
 {
     if (isPlayer)
     {
         ShootingEnemyBase e = c.GetComponent <ShootingEnemyBase>();
         if (e)
         {
             OnHitEnemy(e);
         }
     }
     else
     {
         ShootingPlayerBase p = c.GetComponent <ShootingPlayerBase>();
         if (p)
         {
             OnHitPlayer(p);
         }
     }
 }
Exemplo n.º 4
0
 protected override void OnHitPlayer(ShootingPlayerBase player)
 {
     player.Damage();
     Hit();
 }
Exemplo n.º 5
0
 protected virtual void OnHitPlayer(ShootingPlayerBase player)
 {
 }