Exemple #1
0
    // Start is called before the first frame update
    new void Start()
    {
        base.Start();

        agentMover       = (AgentMover)Utility.ComponentCheck <AgentMover>(gameObject, agentMover);
        sight            = (Sight)Utility.ComponentCheck <Sight>(gameObject, sight);
        sight.sightEvent = SheepSightEvent;

        animalType = AnimalType.Sheep;
    }
Exemple #2
0
        private void Awake()
        {
            MaterialPropertyBlock materialBlock = new MaterialPropertyBlock();

            materialBlock.SetColor("_Color", Random.ColorHSV());
            SkinnedMeshRenderer renderer = GetComponentInChildren <SkinnedMeshRenderer>();

            renderer.SetPropertyBlock(materialBlock, 0);

            _startPos         = transform.position;
            _firstDestination = new Vector3(Random.Range(-12f, 12f), 0f, Random.Range(20f, 30f));
            _lastDestination  = new Vector3(0f, 0f, 220f);

            _agentAnimationController = new AgentAnimationController(this);
            _agentMover = new AgentMover(this);
            _agent      = GetComponent <NavMeshAgent>();

            //Zorluk Ayarları
            _agent.stoppingDistance = Random.Range(0f, 4f);
        }