Exemple #1
0
	void OnCollisionEnter(Collision coll) {
		if (coll.gameObject.tag == "Tiles") {
			movingState = GelState.stop;
			State normalMovementState = new EnemyMovementState (this, transform.position, speed);
			base.BehaviorStateMathine.ChangeState (normalMovementState);
		}
	}
Exemple #2
0
 // Update is called once per frame
 protected override void Update()
 {
     //		float time_delta_fraction = Time.deltaTime / (1.0f / Application.targetFrameRate);
     base.Update();
     base.BehaviorStateMathine.Update();
     if (base.BehaviorStateMathine.IsFinished())
     {
         if (movingState == GelState.move)
         {
             movingState = GelState.stop;
             State normalMovementState = new EnemyMovementState(this, this.transform.position, speed);
             base.BehaviorStateMathine.ChangeState(normalMovementState);
         }
         else
         {
             movingState = GelState.move;
             int 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);
             }
         }
     }
 }
Exemple #3
0
    // Use this for initialization
    protected override void Start()
    {
        movingState = GelState.move;
        State normalMovementState = new EnemyMovementState(this, randomTakeStep(), speed);

        base.BehaviorStateMathine.ChangeState(normalMovementState);
    }
Exemple #4
0
 void OnCollisionEnter(Collision coll)
 {
     if (coll.gameObject.tag == "Tiles")
     {
         movingState = GelState.stop;
         State normalMovementState = new EnemyMovementState(this, transform.position, speed);
         base.BehaviorStateMathine.ChangeState(normalMovementState);
     }
 }
Exemple #5
0
	// Update is called once per frame
	protected override void Update ()
	{
		//		float time_delta_fraction = Time.deltaTime / (1.0f / Application.targetFrameRate);
		base.Update ();
		base.BehaviorStateMathine.Update ();
		if (base.BehaviorStateMathine.IsFinished()) {
			if (movingState == GelState.move) {
				movingState = GelState.stop;
				State normalMovementState = new EnemyMovementState (this, this.transform.position, speed);
				base.BehaviorStateMathine.ChangeState (normalMovementState);
			} else {
				movingState = GelState.move;
				int 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);
				}
			}
		}
	}
Exemple #6
0
	// Use this for initialization
	protected override void Start () {
		movingState = GelState.move;
		State normalMovementState = new EnemyMovementState (this, randomTakeStep(), speed);
		base.BehaviorStateMathine.ChangeState (normalMovementState);
	}