void Awake()
 {
     enemyStateMachine = GetComponent <EnemyStateMachine> ();
     navMeshController = GetComponent <NavMeshController> ();
     visionController  = GetComponent <VisionController> ();
     enemyActionState  = GetComponent <EnemyActionState> ();
 }
Example #2
0
    //private float DistanceDetect = 3.5f;

    // Start is called before the first frame update
    void Start()
    {
        //player = GameObject.FindWithTag("ActivePlayer");
        target = player.transform;
        InvokeRepeating("throwObj", 1, 1);
        navmesh = this.GetComponent <NavMeshController>();
    }
Example #3
0
 private void Awake()
 {
     maquinaDeEstados   = GetComponent <MaquinaEstados>();
     controladorNavMesh = GetComponent <NavMeshController>();
     controladorVision  = GetComponent <ControlVision>();
     siguientePuntoRuta = 0;
 }
        private IEnumerator AttackRanged(ICombatTarget target)
        {
            var position = _hit.transform.position;

            NavMeshController.LookAt(transform, position - _myPosition);
            _animatorController.OnAttackRanged();
            (_ownerObject as ICombatAggressor)?.AttackTarget(target);

            yield return(new WaitForSeconds(.4f));

            var instance = Instantiate((_rangedWeapon.item as ThrowingWeaponItem)?.weaponPrefab,
                                       throwingPoint.transform.position, instanceAngles);

            instance.transform.parent = throwingPoint.transform;
            var instanceRigidbody = instance.GetComponent <Rigidbody>();

            instanceRigidbody.isKinematic = false;

            instanceRigidbody.AddForce((position - _myPosition).normalized * projectileSpeed,
                                       ForceMode.Impulse);

            _rangedWeapon.ReduceAmount(1);
            if (_rangedWeapon.amount == 0)
            {
                _rangedWeapon.item = null;
                PlayerMainScript.MyPlayer.UnequipWeapon();
            }
        }
Example #5
0
 public void Placed(GameObject placedGo)
 {
     Placer.DisablePlacing();
     placeBtn.SetActive(false);
     uiToHide.SetActive(true);
     closeBtn.SetActive(false);
     NavMeshController.Bake();
 }
Example #6
0
    private void Start()
    {
        // Find the active player defined by Become Script
        player = GameObject.FindWithTag("ActivePlayer");

        // Get the NavMeshAgent components
        controller = GetComponent <NavMeshController>();
        agent      = controller.GetComponent <NavMeshAgent>();
    }
Example #7
0
 private void Awake()
 {
     coneRadarSystem    = new ConeRadarSystem();
     circleRadar        = new CircleRadarSystem();
     animatorController = new PlayerAnimatorController(GetComponent <Animator>());
     NavMeshController  = new NavMeshController(GetComponent <NavMeshAgent>());
     StartCoroutine(InitJoystick());
     GetComponent <RangedAttacker>().enabled = false;
     _NPCsAround = new Collider[20];
 }
Example #8
0
 // Use this for initialization
 void Start()
 {
     Navigate      = this.GetComponent <NavMeshController>();
     User          = this.gameObject;
     DesiredAction = Action;
     User.AddComponent <SphereCollider>();
     User.GetComponent <SphereCollider>().isTrigger = true;
     User.GetComponent <SphereCollider>().radius    = Radius;
     Debug.Log("Collider made");
 }
Example #9
0
    void DoDamage(int damage, float x, float y, float z)
    {
        NavMeshController pl = transform.GetComponent <NavMeshController>();

        if (pl)
        {
            //Debug.Log("Have done Damage");
            Vector3 vct = new Vector3(x, y, z);
            pl.GetDamage(damage, vct);
        }
    }
    public void Init(OfficeDesk officeDesk, NavMeshController navMeshController, EmployeeAnimationController animController, EmployeeParticlesController particlesController)
    {
        personalOfficeDesk        = officeDesk;
        personalOfficeDesk.Filled = true;

        this.navMeshController   = navMeshController;
        this.animController      = animController;
        this.particlesController = particlesController;

        Speed = 1;
    }
Example #11
0
    /// <summary>
    /// Builds the tile map along its properties
    /// </summary>
    public void CreateLevel()
    {
        m_edgeController = GameObject.FindGameObjectWithTag("EdgeController").GetComponent <EdgeController>();
        InitializeTileMap();
        SetTileNeighbors();

        if (m_meshController == null)
        {
            m_meshController = FindObjectOfType <NavMeshController>();
        }
        m_meshController.Build();
    }
Example #12
0
    void Start()
    {
        // Get the NavMeshAgent component
        agent      = this.GetComponent <NavMeshAgent>();
        controller = GetComponentInParent <NavMeshController>();

        // Calls the "Pickupper" script on the player (if you follow the Pickupper script's instructions, the player should have the pickupper script on him)
        pickUpFunction = player.GetComponent <Pickupper>();

        // Enemy starts his round
        GoToNextPoint();
    }
Example #13
0
    void Start()
    {
        currentPatrolPoint = 0;

        // Get the NavMeshAgent component
        //agent = this.GetComponent<NavMeshAgent>();
        controller = GetComponentInParent <NavMeshController>();
        agent      = controller.GetComponent <NavMeshAgent>();


        // Enemy starts his round
        StartPatrol();
    }
    void Start()
    {
        Debug.Log("loading...");
        buildingsNavMeshController = transform.Find("BuildingsOnlyNavMesh").GetComponent(typeof(NavMeshController)) as NavMeshController;
        roadsNavMeshController     = transform.Find("RoadsOnlyNavMesh").GetComponent(typeof(NavMeshController)) as NavMeshController;

        terrain = transform.Find("Terrain").gameObject;
        roads   = transform.Find("Roads").gameObject;

        DontDestroyOnLoad(gameObject);
        LoadAllTiles();
        // ReadMapFromXML("Test");
        GenerateFlatLandMap(100, 100);
    }
Example #15
0
        private void Update()
        {
            if (_isInited == false)
            {
                return;
            }
            _inputDirections = new Vector2(directionalJoystick.Horizontal, directionalJoystick.Vertical);
            NavMeshController.Move(transform, _inputDirections,
                                   playerObject.Energy.CurrentPoints > 0 ? characterRunSpeed : characterWalkSpeed);

            animatorController.OnMove(_inputDirections.magnitude, playerObject.Energy.CurrentPoints);

            inventory.UpdateItems();
            ActivateNPCs();
        }
Example #16
0
        public void AttackRanged()
        {
            if (!Input.GetMouseButtonDown(0))
            {
                return;
            }
            RaycastHit hitInfo;
            var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray.origin, ray.direction, out hitInfo))
            {
                var npc = hitInfo.collider.gameObject.transform.parent.GetComponent <NpcMainScript>();
                if (npc != null)
                {
                    NavMeshController.LookAt(transform, npc.transform.position);
                    animatorController.OnAttackRanged();
                }
            }
        }
Example #17
0
 protected override void Awake()
 {
     if (Object.op_Equality((Object)this._navMeshCon, (Object)null))
     {
         this._navMeshCon = (NavMeshController)((Component)this).GetComponent <NavMeshController>();
     }
     if (Object.op_Equality((Object)this._navMeshCon, (Object)null))
     {
         this._navMeshCon = (NavMeshController)((Component)this).GetComponentInChildren <NavMeshController>(true);
     }
     if (Object.op_Equality((Object)this._navMeshCon, (Object)null))
     {
         this.Destroy();
     }
     else
     {
         base.Awake();
     }
 }
Example #18
0
    void Awake()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }

        SetCursorTexture((Texture2D)Resources.Load("UI/cursor"));
        controllerProfile    = ControllerProfile.WASD;
        menuActive           = MenuActive.MENU;
        customKey            = new KeyCode[8];
        TogglePlayerMovement = true;
        navMeshController    = GameObject.FindWithTag("Manager/NavMeshManager").GetComponent <NavMeshController>();
        projectileManager    = GameObject.FindWithTag("Manager/ProjectileManager").GetComponent <ProjectileManager>();
        buffManager          = GameObject.FindWithTag("Manager/BuffManager").GetComponent <BuffManager>();
        _largeProjectile     = (GameObject)Resources.Load("Prefabs/LargeProjectile");
        _smallProjectile     = (GameObject)Resources.Load("Prefabs/SmallProjectile");
        _smoke             = (GameObject)Resources.Load("Prefabs/Particles/Smoke");
        _bot               = (GameObject)Resources.Load("Prefabs/Bot");
        _blankImage        = GameObject.FindWithTag("UI/GameCanvas").transform.FindChild("Blank").GetComponent <Image>();
        _shootEffectPrefab = (GameObject)Resources.Load("Prefabs/Particles/ShootEffect");
        activeEntities     = GameObject.FindWithTag("ActiveEntities");
        Player             = GameObject.FindGameObjectWithTag("Player");

        inventoryManager = new InventoryManager();
        AddQuickItemSlotToList();
        EnableMenu(MenuActive.MENU);


        if (EventManager.OnShoot != null)
        {
            EventManager.OnShoot();
        }
    }
 void Awake()
 {
     navMeshController = GetComponent <NavMeshController>();
 }
Example #20
0
 private void Awake()
 {
     controladorNavmesh = GetComponent <NavMeshController>();
 }
Example #21
0
 void Awake()
 {
     navMeshController = GetComponent <NavMeshController> ();
     lineRenderer      = GetComponent <LineRenderer> ();
 }
Example #22
0
 void Awake()
 {
     navMeshController = GetComponent <NavMeshController>();
     stateMachine      = GetComponent <StateMachine>();
     visionController  = GetComponent <VisionController>();
 }
Example #23
0
 private void Awake()
 {
     Instance = this;
 }