// Use this for initialization
    void Start()
    {
        switcher = GetComponent <FacingSpriteSwitcher> ();

        clip = GetComponents <AudioSource>()[0].clip;
        anim = GetComponent <Animator>();

        playerMove = GetComponent <PlayerMovement> ();

        HealthSystem hs = GetComponent <HealthSystem> ();

        if (hs)
        {
            hs.OnObjectDead   += SetDeadAsTrue;
            hs.OnObjectRevive += SetDeadAsFalse;
        }
    }
Exemplo n.º 2
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        state          = animator.GetComponent <LaserCannonState> ();
        cs             = animator.GetComponentInChildren <ControlStatus> ();
        control        = animator.GetComponent <CannonHackerControl> ();
        hackerSwitcher = cs.Hacker.GetComponent <FacingSpriteSwitcher> ();
        hackerAim      = cs.Hacker.GetComponentInChildren <PlayerAim> ();

//		// initially point to hacker
//		state.playerAimPos = cs.Hacker.position;

        if (state)
        {
            state.PlayerUpdateAimLaser();
            state.aimLaser.GetComponent <AimLaserUpdate> ().SnapPosition();
            state.aimLaser.gameObject.SetActive(true);

            state.TurnOnHint();
        }
    }