Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     this._attackcallback = (t) =>
     {
         int a = Random.Range(1, 3);
         AudioManager._instance.PlayAudio("击中" + a);
     };
 }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        this._attackcallback = (t) =>
        {
            if (t.GetComponent <EnemyBase>().hitoffable)
            {
                t.transform.right = transform.position.x > t.transform.position.x ? new Vector2(1, 0) : new Vector2(-1, 0);

                GetComponentInParent <Rigidbody2D>().velocity = new Vector2(0, GetComponentInParent <Rigidbody2D>().velocity.y);

                t.GetComponent <Rigidbody2D>().velocity = Vector2.zero; t.GetComponent <Rigidbody2D>().AddForce(-t.transform.right * 30, ForceMode2D.Impulse);
            }
            PlayerInfoController._instance.AddEnergy(3);
            PlayerInfoController._instance.AddMP(5);
            int a = Random.Range(1, 3);
            AudioManager._instance.PlayAudio("击中" + a);
            game.Scene._instance.player.GetComponent <Rigidbody2D>().velocity = Vector2.zero;
            game.Scene._instance.player.GetComponent <Rigidbody2D>().AddForce(-game.Scene._instance.player.transform.right * 5, ForceMode2D.Impulse);
        };
    }
Exemplo n.º 3
0
    private void OnEnable()
    {
        this._attackcallback = (t) => {
            if (game.Scene._instance.player.transform.position.x > t.transform.position.x)
            {
                transform.rotation = Quaternion.Euler(0, 180, 0);
            }
            else
            {
                transform.rotation = Quaternion.identity;
            }
            t.GetComponent <Rigidbody2D>().AddForce(t.transform.right * 50, ForceMode2D.Impulse);

            int a = Random.Range(1, 3);
            AudioManager._instance.PlayAudio("击中" + a);
        };



        parent = transform.parent;
        _anim  = GetComponent <Animator>();
    }
Exemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     this._attackcallback = (t) => { Debug.Log((GetComponentInParent <Enemy_7_Controller>()._machine.GetState("attack") as Enemy_7_AttackState).id); (GetComponentInParent <Enemy_7_Controller>()._machine.GetState("attack") as Enemy_7_AttackState).AttackStop(); };
 }