Пример #1
0
        public override void Update()
        {
            projectileRigidbody.velocity = new Vector2(speed, projectileRigidbody.velocity.y);

            if (!JVUtil.AboutEqual(rotationSpeed, 0f))
            {
                projectileRigidbody.angularVelocity = rotationSpeed;
            }

            base.Update();
        }
Пример #2
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            if (other.tag == "Player")
            {
                PlayerHealth playerHealth = other.GetComponent <PlayerHealth> ();

                if (playerHealth != null)
                {
                    playerHealth.TakeDamage(damage);
                }

                KnockbackOnHit knockback = other.GetComponent <KnockbackOnHit> ();

                if (knockback != null)
                {
                    knockback.knockbackFromRight = JVUtil.IsTargetOnTheLeft(other.transform, transform);
                }
            }
        }
Пример #3
0
        void OnTriggerEnter2D(Collider2D other)
        {
            if (other.tag == "Enemy")
            {
                //Instantiate (enemyDeathEffect, other.transform.position, other.transform.rotation);
                //Destroy (other.gameObject);
                //ScoreManager.AddPoints (pointsForKill);

                other.GetComponent <Health> ().TakeDamage(damage);

                KnockbackOnHit knockback = other.GetComponent <KnockbackOnHit> ();

                if (knockback != null)
                {
                    knockback.knockbackFromRight = JVUtil.IsTargetOnTheLeft(other.transform, transform);
                }
            }

            SelfDestroy();
        }