void OnEnable()
    {
        runSpeed               = character.RunSpeed;
        controller             = this.gameObject.GetComponent <CharacterController2D>();
        controller.OnLandEvent = new UnityEvent();
        controller.OnLandEvent.AddListener(OnLanding);
        controller.OnCrouchEvent = new BoolEvent();
        controller.OnCrouchEvent.AddListener(OnCrouching);
        controller.m_JumpForce = character.JumpForce;
        animator = this.gameObject.GetComponent <Animator>();
        character.GameHandler = GameObject.FindObjectOfType <GameHandler>();
        Hit_Controller hit_Controller = character.Bullet.GetComponent <Hit_Controller>();

        hit_Controller.Move1 = new ObjectEvent();
        hit_Controller.Move1.AddListener(character.Move1);
        hit_Controller.Move2 = new ObjectEvent();
        hit_Controller.Move2.AddListener(character.Move2);
        hit_Controller.Move3 = new ObjectEvent();
        hit_Controller.Move3.AddListener(character.Move3);
        hit_Controller.OnMoveFinished = new UnityEvent();
        hit_Controller.OnMoveFinished.AddListener(OnMoveFinished);
        joystick  = FindObjectOfType <Joystick>();
        move1     = GameObject.FindWithTag("move1").GetComponent <Joybutton>();
        move2     = GameObject.FindWithTag("move2").GetComponent <Joybutton>();
        finalMove = GameObject.FindWithTag("finalMove").GetComponent <Joybutton>();
    }
Esempio n. 2
0
    void OnEnable()
    {
        runSpeed               = character.RunSpeed;
        controller             = this.gameObject.GetComponent <CharacterController2D>();
        controller.OnLandEvent = new UnityEvent();
        controller.OnLandEvent.AddListener(OnLanding);
        controller.OnCrouchEvent = new BoolEvent();
        controller.OnCrouchEvent.AddListener(OnCrouching);
        controller.m_JumpForce = character.JumpForce;
        animator = this.gameObject.GetComponent <Animator>();
        character.GameHandler = GameObject.FindObjectOfType <GameHandler>();
        Hit_Controller hit_Controller = character.Bullet.GetComponent <Hit_Controller>();

        hit_Controller.Move1 = new ObjectEvent();
        hit_Controller.Move1.AddListener(character.Move1);
        hit_Controller.Move2 = new ObjectEvent();
        hit_Controller.Move2.AddListener(character.Move2);
        hit_Controller.Move3 = new ObjectEvent();
        hit_Controller.Move3.AddListener(character.Move3);
        hit_Controller.OnMoveFinished = new UnityEvent();
        hit_Controller.OnMoveFinished.AddListener(OnMoveFinished);

        InvokeRepeating("Action", 0.0f, 1.0f);
    }