Beispiel #1
0
    // Use this for initialization
    protected override void Start()
    {
        state = GoriyaState.move;
        State normalMovementState = new EnemyMovementState(this, randomTakeStep(), speed);

        base.BehaviorStateMathine.ChangeState(normalMovementState);
    }
Beispiel #2
0
	public override void hittenByBoomerange (GameObject collider)
	{
		if (state != GoriyaState.stop) {
			state_mem = state;
		}
		state = GoriyaState.stop;
		stun_start_time = Time.time;
	}
Beispiel #3
0
 public override void hittenByBoomerange(GameObject collider)
 {
     if (state != GoriyaState.stop)
     {
         state_mem = state;
     }
     state           = GoriyaState.stop;
     stun_start_time = Time.time;
 }
Beispiel #4
0
 void OnCollisionEnter(Collision coll)
 {
     if (coll.gameObject.tag == "Tiles")
     {
         state = GoriyaState.move;
         State normalMovementState = new EnemyMovementState(this, randomTakeStep(), speed);
         base.BehaviorStateMathine.ChangeState(normalMovementState);
     }
 }
Beispiel #5
0
    // Update is called once per frame
    protected override void Update()
    {
        //		float time_delta_fraction = Time.deltaTime / (1.0f / Application.targetFrameRate);
        base.Update();
        if (state != GoriyaState.stop)
        {
            base.BehaviorStateMathine.Update();
            animationCounter++;
            animationCounter %= 30;
            GetComponent <SpriteRenderer> ().sprite = Sprites [2 * currentMovingTowardDetectorInd + animationCounter / 15];


            if (base.BehaviorStateMathine.IsFinished())
            {
                int randNum = Random.Range(0, 100);
                if (state == GoriyaState.move && randNum < attackProb * 100)
                {
                    state = GoriyaState.attack;
                    Vector3 velocity = (currentMovingTowardDetector.transform.position - transform.position).normalized * 5;
                    velocity.z = 0;
                    State attackState = new GoriyaAttackState(this, boomerang, velocity);
                    base.BehaviorStateMathine.ChangeState(attackState);
                }
                else
                {
                    state   = GoriyaState.move;
                    randNum = Random.Range(0, 100);
                    if (!currentMovingTowardDetector.GetComponent <Detector> ().CollideWithTile() && randNum >= changeDirectionProb * 100)
                    {
                        State normalMovementState = new EnemyMovementState(this, currentMovingTowardDetector.transform.position, speed);
                        base.BehaviorStateMathine.ChangeState(normalMovementState);
                    }
                    else
                    {
                        State normalMovementState = new EnemyMovementState(this, randomTakeStep(), speed);
                        base.BehaviorStateMathine.ChangeState(normalMovementState);
                    }
                }
            }
        }
        else
        {
            if (Time.time - stun_start_time > 5)
            {
                state = state_mem;
            }
        }
    }
Beispiel #6
0
	// Update is called once per frame
	protected override void Update ()
	{
		//		float time_delta_fraction = Time.deltaTime / (1.0f / Application.targetFrameRate);
		base.Update ();
		if (state != GoriyaState.stop) {
			base.BehaviorStateMathine.Update ();
			animationCounter++;
			animationCounter %= 30;
			GetComponent<SpriteRenderer> ().sprite = Sprites [2 * currentMovingTowardDetectorInd + animationCounter / 15];


			if (base.BehaviorStateMathine.IsFinished ()) {
				int randNum = Random.Range (0, 100);
				if (state == GoriyaState.move && randNum < attackProb * 100) {
					state = GoriyaState.attack;
					Vector3 velocity = (currentMovingTowardDetector.transform.position - transform.position).normalized * 5;
					velocity.z = 0;
					State attackState = new GoriyaAttackState (this, boomerang, velocity);
					base.BehaviorStateMathine.ChangeState (attackState);
				} else {
					state = GoriyaState.move;
					randNum = Random.Range (0, 100);
					if (!currentMovingTowardDetector.GetComponent<Detector> ().CollideWithTile () && randNum >= changeDirectionProb * 100) {
						State normalMovementState = new EnemyMovementState (this, currentMovingTowardDetector.transform.position, speed);
						base.BehaviorStateMathine.ChangeState (normalMovementState);
					} else {
						State normalMovementState = new EnemyMovementState (this, randomTakeStep (), speed);
						base.BehaviorStateMathine.ChangeState (normalMovementState);
					}
				}
			}
		} else {
			if (Time.time - stun_start_time > 5) {
				state = state_mem;
			}
		}
	}
Beispiel #7
0
	void OnCollisionEnter(Collision coll) {
		if (coll.gameObject.tag == "Tiles") {
			state = GoriyaState.move;
			State normalMovementState = new EnemyMovementState (this, randomTakeStep(), speed);
			base.BehaviorStateMathine.ChangeState (normalMovementState);
		}
	}
Beispiel #8
0
	// Use this for initialization
	protected override void Start () {
		state = GoriyaState.move;
		State normalMovementState = new EnemyMovementState (this, randomTakeStep(), speed);
		base.BehaviorStateMathine.ChangeState (normalMovementState);
	}