Пример #1
0
        public void OnFreeFallBreak(IAction action)
        {
            Character source = IsOpponent()
                                ? CGame.Instance.opponentCharacter
                                : CGame.Instance.playerCharacter;

            Character target = !IsOpponent()
                                ? CGame.Instance.opponentCharacter
                                : CGame.Instance.playerCharacter;

            Model.CPlayer targetModel = !IsOpponent()
                                ? CGame.Model.opponent
                                : CGame.Model.player;

            if (score > 0)
            {
                source.SetState(
                    score >= CGame.Config.attackStrongScore
                                                ? Character.States.AttackStrong
                                                : Character.States.AttackWeak,

                    () => {
                    CGame.Sounds.ouch.Play();
                    target.SetState(Character.States.Damaged);
                    targetModel.AddDamage(score);
                }
                    );
            }

            CGame.Instance.CheckActive();
        }
Пример #2
0
		void OnTriggerEnter2D(Collider2D collision)
		{
			CPlayer player = collision.GetComponent<CPlayer>();

			if (player != null && collision.gameObject.tag == "player")
			{
				var explosion = Instantiate(explosionEffect, transform.position, transform.rotation);
				CAudioManager.Instance.PlaySFX(ESoundsFx.BulletBoom);

				Destroy(gameObject);
				Destroy(explosion, 1f);

				player.TakeDamage(damage);

			}

		}