// 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); } }
// 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>(); } }
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); } } }
protected override void OnHitPlayer(ShootingPlayerBase player) { player.Damage(); Hit(); }
protected virtual void OnHitPlayer(ShootingPlayerBase player) { }