Inheritance: MonoBehaviour
示例#1
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
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        target    = gameObject;
        boids     = new List <GameObject>();
        deadBoids = new List <GameObject>();
        for (int i = 0; i < numberOfBoids; i++)
        {
            Vector3 pos = transform.position + Random.insideUnitSphere * spawnRadius;
            pos.y = 0.0f;
            Quaternion rot = Quaternion.Euler(0, Random.Range(0, 360), 0);
            boids.Add(Instantiate(boidPrefab, pos, rot));
            boids[i].GetComponent <Boid>().flock = this;
            // TODO - Configure the combat AI on the boid we just built.
            // get the tree, and set any blackbaord variables it may need, such as the mask, the object hit (which will be null to start), the shooting range

            BehaviorTree bt = boids[i].AddComponent <BehaviorTree>();
            bt.AddKey("target");
            bt.AddKey("wait", Random.Range(1.0f, 2.0f));

            Sequence sq = new Sequence();
            sq.tree = bt;
            bt.root = sq;
            //Wait is used because it chaos without it
            Wait wait = new Wait();
            wait.tree          = bt;
            wait.TimeToWaitKey = "wait";

            ZapTarget zt = new ZapTarget();
            zt.tree      = bt;
            zt.TargetKey = "target";

            DetectTarget dt = new DetectTarget();
            dt.tree      = bt;
            dt.TargetKey = "target";

            DamageBoid db = new DamageBoid();
            db.tree      = bt;
            db.TargetKey = "target";

            sq.children.Add(wait);
            sq.children.Add(dt);
            sq.children.Add(zt);
            sq.children.Add(db);
        }
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        Selector     TreeRoot       = new Selector();
        Sequence     ShootSequence  = new Sequence();
        DetectTarget detectTask     = new DetectTarget();
        ZapTarget    zapTask        = new ZapTarget();
        DamageBoid   damageBoidTask = new DamageBoid();

        SetValue("selfBoid", Boid);
        SetValue("Line", line);

        ShootSequence.children.Add(detectTask);
        ShootSequence.children.Add(zapTask);
        ShootSequence.children.Add(damageBoidTask);
        TreeRoot.children.Add(ShootSequence);
        ShootSequence.tree  = this;
        TreeRoot.tree       = this;
        detectTask.tree     = this;
        zapTask.tree        = this;
        damageBoidTask.tree = this;
        root = TreeRoot;
    }
示例#4
0
    public bool enemyDead;            // indica morte no lifeManager;

    // lifeManager _lifeManger;
    void Start()
    {
        // bool controls
        enemyDead           = false;
        externalControl     = false;
        lookAtTrigger       = false;
        shootTriggerManager = false;
        scapeTrigger        = false;
        endScape            = false;

        // getting components
        animator_Manager = soldierGO.GetComponent <AnimatorManager>(); // Acive animations
        detection        = soldierGO.GetComponent <DetectTarget>();    // Recebe componente RayCast

        //_lifeManger = soldierGO.GetComponent<lifeManager>();

        // settings to scape
        startTime     = Time.time;                                                                // Keep a note of the time the movement started (scape function)
        journeyLength = Vector3.Distance(soldierGO.transform.position, scape.transform.position); // Calculate the journey length

        captTarget           = GameObject.Find("Player");
        enemyTarget          = captTarget.gameObject;
        detection.enemiesTag = enemyTarget.tag; // passa a tag do GameObject enemyTarget para a string "enemiesTag" do script DetectTarget
    }
示例#5
0
 private void Awake()
 {
     detectTarget = GetComponent <DetectTarget>();
     anim         = GetComponentInChildren <Animator>();
 }
示例#6
0
 void Awake()
 {
     speed        = GetComponent <MinionData>().Data.MoveSpeed;
     detectTarget = GetComponent <DetectTarget>();
     rb           = GetComponent <Rigidbody>();
 }
示例#7
0
 private void Awake()
 {
     detectTarget = transform.GetComponentInParent <DetectTarget>();
 }