Example #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");
    }
 // 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>();
 }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (!FreezeY)
        {
            transform.Rotate(new Vector3(0, Input.GetAxisRaw("Mouse X") * _orbitSpeed.x, 0), Space.Self);
        }

        Vector3 newRot = _xAxis.localEulerAngles;

        newRot.x += Input.GetAxisRaw("Mouse Y") * _orbitSpeed.y;
        newRot.x  = BasePlayerScript.ClampAngle(newRot.x, _xClamp.x, _xClamp.y);
        _xAxis.localEulerAngles = newRot;
    }
Example #4
0
 private void Start()
 {
     _player = transform.parent.GetComponent <BasePlayerScript>();
 }