コード例 #1
0
    public void TurnOnHackerControl(Transform trans)
    {
        CannonHackerControl control = transform.parent.GetComponent <CannonHackerControl> ();

        if (control)
        {
            control.enabled = true;
        }
    }
コード例 #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)
    {
        control = animator.GetComponent <CannonHackerControl> ();
        state   = animator.GetComponent <LaserCannonState> ();

        if (state)
        {
            state.TurnOnHint();
        }
    }
コード例 #3
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> ();
		control = animator.GetComponent<CannonHackerControl> ();
		// get the start pos of the laser
		laserStart = state.shootLaser.position;
		// decide where to shoot the laser at
		shootPos = state.aimLaser.position;

		shootDir = (shootPos - laserStart).normalized;
		// the cannon at least can shoot $radius units 
		maxDistance = Mathf.Max (maxDistance, state.fov.radius);

		state.ShootLaser (shootDir, maxDistance, fadeSeconds, lifeTime, false);


	}
コード例 #4
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();
        }
    }