Example #1
0
    void Update()
    {
        trenchBehavior();

        switch (currentState)
        {
        case sceneBuilder.Behavior.Idle:
            // .activeVigilant = false;
            opTypeShoot(false);
            //Debug.Log("IDLE");
            break;

        case sceneBuilder.Behavior.Vigilant:
            captGunbools.activeVigilant = true;
            opTypeShoot(false);
            //Debug.Log("VIGILANT");
            break;

        case sceneBuilder.Behavior.Shoot:
            opTypeShoot(true);
            //Debug.Log("SHOOT");
            break;

        default:
            currentState = sceneBuilder.Behavior.Idle;
            break;
        }
    }
Example #2
0
 void trenchBehavior()
 {
     // case raycast detect something
     if (!detection.hitDetect)
     {
         captGunbools.activeLookAt = false;
         return;
     }
     // Recognition Action
     if (detection.currentDistance <= detectionRadius &&
         detection.currentDistance > effectiveDistance)
     {
         captGunbools.activeLookAt = true;
         currentState = identificationAction;
         //Debug.Log("RECOGNITION");
     }
     else
     // Effective Action
     if (detection.currentDistance <= effectiveDistance)
     {
         captGunbools.activeLookAt = true;
         currentState = effectiveAction;
         //Debug.Log("EFFECTIVE");
     }
     else
     {   // back to Vigilant
         currentState = sceneBuilder.Behavior.Vigilant;
         //Debug.Log("DEFAULT");
         opTypeShoot(false);
     }
 }
Example #3
0
    void Start()
    {
        captGunbools     = trenchGO.GetComponent <lookAtTrench>();
        detection        = trenchGO.GetComponent <DetectTarget>();
        gettingTypeShoot = _particleSystem.GetComponent <shootMAG>();

        captTarget           = GameObject.Find("Player");
        target               = captTarget.transform;
        detection.enemiesTag = target.tag;
        currentState         = sceneBuilder.Behavior.Idle; // vehicle start in Vigilant
    }