Example #1
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)
    {
        LaserCannonSP lcsp = animator.GetComponent <LaserCannonSP> ();

        if (lcsp)
        {
            lcsp.SetPlayerSprite();
            lcsp.SetPlayerColor();
        }

        Transform        hacker = animator.GetComponentInChildren <ControlStatus> ().Hacker;
        LaserCannonState state  = animator.GetComponent <LaserCannonState> ();

        state.aimLaserLine.gameObject.SetActive(false);
        state.playerAimPos = hacker.position;

        if (hacker)
        {
            PlayerControl pc = hacker.GetComponent <PlayerControl> ();
            if (pc)
            {
                pc.canControl = false;
            }
        }
    }
Example #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();
        }
    }
	 // 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);


	}
Example #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)
    {
        LaserCannonSP lcsp = animator.GetComponent <LaserCannonSP> ();

        if (lcsp)
        {
            lcsp.SetEnemySprite();
            lcsp.SetEnemyColor();
        }


        LaserCannonState state = animator.GetComponent <LaserCannonState> ();

        state.aimLaserLine.gameObject.SetActive(false);
        state.DisableShootLaser();
    }
Example #5
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> ();
     status = animator.GetComponentInChildren <LaserCannonStatus> ();
     // turn on laser line
     if (state)
     {
         state.EnemyUpdateAimLaser();
         state.aimLaser.GetComponent <AimLaserUpdate> ().SnapPosition();
         state.aimLaser.gameObject.SetActive(true);
     }
     if (status)
     {
         // status.EnableServerLine (state.playerLastPos);
     }
 }
Example #6
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();
        }
    }
Example #7
0
//	bool damaging{
//		get{
//			if (state)
//				return state.damaging;
//			else
//				return false;
//		}
//	}

    // 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> ();
        // get the start pos of the laser
        laserStart = state.shootLaser.position;
        // decide where to shoot the laser at
        shootPos = state.aimLaser.position;
        // guess where the player might be at after fade seconds
        if (state.playerTarget)
        {
            Rigidbody2D rb = state.playerTarget.GetComponent <Rigidbody2D> ();
            if (rb)
            {
                shootPos = shootPos + (Vector3)(rb.velocity * fadeSeconds);
            }
        }
        shootDir = (shootPos - laserStart).normalized;
        // the cannon at least can shoot $radius units
        maxDistance = Mathf.Min(maxDistance, state.fov.radius);

        state.ShootLaser(shootDir, maxDistance, fadeSeconds, lifeTime, false);
    }
 // Use this for initialization
 void Start()
 {
     state = GetComponent <LaserCannonState> ();
 }