示例#1
0
    // Use this for initialization
    void Start()
    {
        Health     = 2;
        _player    = GameObject.FindGameObjectWithTag("Player").GetComponent <BasePlayerScript>();
        Animator   = transform.Find("Model").GetComponent <Animator>();
        _indicator = transform.Find("Indicator").GetComponent <IndicatorScript>();
        _startRot  = transform.rotation;
        _snd       = GetComponent <SoundManager>();

        //behaviour tree
        _rootNode =
            new SequenceNode(
                new ActionNode(Animate),
                new SelectorNode(
                    new SequenceNode(
                        new SelectorNode(
                            new ConditionNode(PlayerSpottedAndInRange),
                            new ConditionNode(HitByBarrel)
                            ),
                        new ActionNode(AimAndShoot)
                        ),
                    new ActionNode(StandGuard)
                    )
                )
        ;

        StartCoroutine("RunTree");
    }
示例#2
0
    void Awake()
    {
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy(gameObject);
        //DontDestroyOnLoad(gameObject);

    }
 // Use this for initialization
 public void Start()
 {
     Health       = 2;
     _agent       = GetComponent <NavMeshAgent>();
     Animator     = transform.Find("Model").GetComponent <Animator>();
     _player      = GameObject.FindGameObjectWithTag("Player").GetComponent <BasePlayerScript>();
     _povTimer    = _povTime;
     _searchTimer = _searchTime;
     _chaseTimer  = _chaseTime;
     _indicator   = transform.Find("Indicator").GetComponent <IndicatorScript>();
 }
示例#4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     //DontDestroyOnLoad(gameObject);
 }