Beispiel #1
0
 void ChangeState(float timeBeforeStateChange, SclorgState nextState)//small state changer, takes in time you want to wait for before state change, and the next state
 {
     if (gameTime > timeBeforeStateChange)
     {
         gameTime = 0;
         States   = nextState;
     }
 }
Beispiel #2
0
 public void DeathByLight()
 {
     States   = SclorgState.DEATH;
     gameTime = 0;
     SclorgAnim.Play("S_HitByLight2");
     Invoke("SinkToGround", 5f);
     Debug.Log("die");
 }
Beispiel #3
0
    void Fire()
    {
        Rigidbody projectileClone = Instantiate(projectile, shootPos.position, transform.rotation) as Rigidbody;

        projectileClone.velocity = transform.forward * 30;
        if (DistanceBetween(player.position, transform.position) < shootRange)
        {
            States = SclorgState.AIM;
        }
        else if (DistanceBetween(player.position, transform.position) > shootRange)
        {
            SclorgAnim.StopPlayback();
            States = SclorgState.PURSUE;
        }
    }
Beispiel #4
0
    void SclorgMovement(bool isAiming = false)
    {
        target       = player.gameObject;
        targetSpeed  = target.GetComponent <Rigidbody>().velocity;
        futurePos    = target.transform.position + (targetSpeed * (_distance / iterations));
        _direction   = futurePos - transform.position;
        _direction.y = 0;
        Quaternion lookRot = Quaternion.LookRotation(_direction);

        _rbAI.MoveRotation(lookRot);
        if (!isAiming)
        {
            transform.localPosition += transform.forward * Time.deltaTime * speedAI;
            if (DistanceBetween(player.position, transform.position) < shootRange)
            {
                States = SclorgState.AIM;
            }
        }
        //transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction), 2f * Time.deltaTime);
    }
Beispiel #5
0
    protected override void ActivateAbility()
    {
        currentTargetPosition = player.transform.position;
        switch (sclorgStates)
        {
        case SclorgState.PURSUE:
            SclorgAnim.SetBool("isAttacking", false);
            SclorgAnim.SetBool("isMoving", true);
            MoveTowardsTarget();
            if (_distance < 10 && _timer > 0.1f && !SclorgAnim.GetBool("isAttacking"))
            {
                _timer = 0;
                SclorgAnim.SetBool("isAttacking", true);
                SclorgAnim.SetBool("isMoving", false);
                shoot        = false;
                sclorgStates = SclorgState.SHOOT;
            }
            break;

        case SclorgState.SHOOT:
            SclorgAnim.SetBool("isAttacking", true);
            SclorgAnim.SetBool("isMoving", false);
            LookAtPlayer();
            if (_timer > 2f && !shoot && SclorgAnim.GetBool("isAttacking"))
            {
                Fire();
            }
            if ((_timer >= 2.24f || _distance > 10) && SclorgAnim.GetBool("isAttacking"))
            {
                SclorgAnim.SetBool("isAttacking", false);
                SclorgAnim.SetBool("isMoving", true);
                sclorgStates = SclorgState.PURSUE;
            }
            break;

        case SclorgState.DEATH:
            break;
        }
    }
Beispiel #6
0
	protected override void ActivateAbility()
	{
	
		currentTargetPosition = player.transform.position;
		switch (sclorgStates)
		{ 
			case SclorgState.PURSUE:
				SclorgAnim.SetBool("isAttacking", false);
				SclorgAnim.SetBool("isMoving",true);
				MoveTowardsTarget();
				if (_distance < 10 && _timer > 0.1f && !SclorgAnim.GetBool("isAttacking"))
				{
					_timer = 0;
					SclorgAnim.SetBool("isAttacking", true);
					SclorgAnim.SetBool("isMoving", false);
					shoot = false;
					sclorgStates = SclorgState.SHOOT;
				}
				break;
			case SclorgState.SHOOT:
				SclorgAnim.SetBool("isAttacking", true);
				SclorgAnim.SetBool("isMoving", false);
				LookAtPlayer();
				if (_timer > 2f && !shoot && SclorgAnim.GetBool("isAttacking"))
				{
					Fire();
				}
				if ((_timer >= 2.24f || _distance > 10) && SclorgAnim.GetBool("isAttacking"))
				{
					SclorgAnim.SetBool("isAttacking", false);
					SclorgAnim.SetBool("isMoving", true);
					sclorgStates = SclorgState.PURSUE;
				}
				break;
			case SclorgState.DEATH:
				break;
		}
	}
Beispiel #7
0
 void ChangeState(float timeBeforeStateChange, SclorgState nextState)//small state changer, takes in time you want to wait for before state change, and the next state
 {
     if (gameTime > timeBeforeStateChange)
     {
         gameTime = 0;
         States = nextState;
     }
 }
Beispiel #8
0
 void SclorgMovement(bool isAiming = false)
 {
     target = player.gameObject;
     targetSpeed = target.GetComponent<Rigidbody>().velocity;
     futurePos = target.transform.position + (targetSpeed * (_distance / iterations));
     _direction = futurePos - transform.position;
     _direction.y = 0;
     Quaternion lookRot = Quaternion.LookRotation(_direction);
     _rbAI.MoveRotation(lookRot);
     if(!isAiming)
     {
         transform.localPosition += transform.forward * Time.deltaTime * speedAI;
         if(DistanceBetween(player.position,transform.position) < shootRange)
         {
             States = SclorgState.AIM;
         }
     }
     //transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction), 2f * Time.deltaTime);
 }
Beispiel #9
0
 public void DeathByLight()
 {
     States = SclorgState.DEATH;
     gameTime = 0;
     SclorgAnim.Play("S_HitByLight2");
     Invoke("SinkToGround", 5f);
     Debug.Log("die");
 }
Beispiel #10
0
 void Fire()
 {
     Rigidbody projectileClone = Instantiate(projectile, shootPos.position, transform.rotation) as Rigidbody;
     projectileClone.velocity = transform.forward * 30;
    if(DistanceBetween(player.position,transform.position)<shootRange)
     {
         States = SclorgState.AIM;
     }
    else if(DistanceBetween(player.position,transform.position) > shootRange)
     {
         SclorgAnim.StopPlayback();
         States = SclorgState.PURSUE;
     }
 }