public PlayerInformation(Storage.Races race) { _race = race; buildings = new List <PlayableEntity>(); units = new List <PlayableEntity>(); resources = new ResourceAmount(); }
public void Start() { _race = transform.parent.GetComponent <Barrack>().getRace(); _revealer = transform.parent.FindChild("LightHouse-Revealer").GetComponent <LightHouseRevealer>(); _collider = GetComponent <SphereCollider>(); _collider.radius = _radius / _scaleOffset; _collider.center = new Vector3(0f, -8f, 0f); }
public static BasePlayer getOwner(Storage.Races race) { if (race == info.GetPlayerRace()) { return(player); } return(ia); }
public void Start() { _race = transform.parent.GetComponent<Barrack>().getRace(); _revealer = transform.parent.FindChild("LightHouse-Revealer").GetComponent<LightHouseRevealer>(); _collider = GetComponent<SphereCollider>(); _collider.radius = _radius / _scaleOffset; _collider.center = new Vector3(0f, -8f, 0f); }
/// <summary> /// Public function to load different contexts /// </summary> public void LoadSceneContext() { if (_playerRace == _iaRace) { _iaRace = Storage.Races.ELVES; } LoadHUD(); }
public void Start() { _race = transform.parent.GetComponent <Barrack>().getRace(); _collider = GetComponent <SphereCollider>(); _collider.radius = 0; _status = Status.CLOSE; _animator = transform.parent.GetComponent <Animator>(); transform.parent.GetComponent <Barrack>().register(Barrack.Actions.BUILDING_FINISHED, OnBuildingFinished); _blocking_gate = transform.parent.GetComponent <DetourFlag>(); }
public void Start() { _race = transform.parent.GetComponent<Barrack>().getRace(); _collider = GetComponent<SphereCollider>(); _collider.radius = 0; _status = Status.CLOSE; _animator = transform.parent.GetComponent<Animator>(); transform.parent.GetComponent<Barrack>().register(Barrack.Actions.BUILDING_FINISHED, OnBuildingFinished); _blocking_gate = transform.parent.GetComponent<DetourFlag>(); }
/// <summary> /// Some buildings need a different rotation, not the default. In order to be shown properly /// </summary> /// <param name="race"></param> /// <param name="type"></param> private void CheckBuildingDefaultRotation(Storage.Races race, Storage.BuildingTypes type) { if (type == Storage.BuildingTypes.SAWMILL) { Debug.Log("Applying rotation to " + type); ApplyRotation(); } else if (race == Storage.Races.MEN && type == Storage.BuildingTypes.ARCHERY) { Debug.Log("Applying rotation to " + race + " " + type); ApplyRotation(); } }
//used for AI so smellEnemies is always true public Squad(Storage.Races race, int error) { _auto = new AutoUnregister(this); _race = race; _data.Add(DataType.BOUNDING_BOX, new BoundingBox(this)); _data.Add(DataType.ATTACK_VALUE, new AttackValue(this, error)); _data.Add(DataType.PATROL_DATA, new PatrolData(this)); _data.Add(DataType.ASSIST_DATA, new AssistData(this)); _maxAttackRange = Storage.Info.get.of(_race, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest; _data.Add(DataType.SMELLED_ENEMIES, new SmelledEnemies(this)); }
/// <summary> /// Starts creating a building, required the name of the building ex: 'elf-farm' /// </summary> /// <param name="name"></param> public void createBuilding(Storage.Races race, Storage.BuildingTypes type, bool continuousConstruction = false) { if (!_newBuilding.placing && isAffordable(race, type)) { _newBuilding.race = race; _newBuilding.type = type; _newBuilding.ghost = CreateGhostBuilding(race, type); _newBuilding.material = _newBuilding.ghost.GetComponent <Renderer>().material; _newBuilding.placing = true; _newBuilding.continuousConstruction = continuousConstruction; BasePlayer.player.setCurrently(Player.status.PLACING_BUILDING); CheckBuildingDefaultRotation(race, type); } }
/// <summary> /// Sets the color for the current race /// </summary> /// <param name="race"></param> public void SetColorRace(Storage.Races race) { switch (race) { case Storage.Races.ELVES: _selectionColor = Color.green; break; case Storage.Races.MEN: _selectionColor = Color.red; break; } selection.material.color = _selectionColor; }
public AttackAgent(AIController ai, AssistAgent assist, string name) : base(ai, name) { if (ai.race == Storage.Races.ELVES) { _maxUnitRange = Storage.Info.get.of(Storage.Races.MEN, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest; _enemyRace = Storage.Races.MEN; } else { _maxUnitRange = Storage.Info.get.of(Storage.Races.ELVES, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest; _enemyRace = Storage.Races.ELVES; } assistAgent = assist; }
public static GameObject CreateBanner(Storage.Races race) { GameObject banner = null; switch (race) { case Storage.Races.ELVES: banner = Instantiate((GameObject)Resources.Load("Prefabs/Banners/Elves", typeof(GameObject))); break; case Storage.Races.MEN: banner = Instantiate((GameObject)Resources.Load("Prefabs/Banners/Humans", typeof(GameObject))); break; } return(banner); }
public static GameObject CreatePoint(Storage.Races race) { GameObject point = null; switch (race) { case Storage.Races.ELVES: point = Instantiate((GameObject)Resources.Load("Prefabs/MeetingPoints/Elves", typeof(GameObject))); break; case Storage.Races.MEN: point = Instantiate((GameObject)Resources.Load("Prefabs/MeetingPoints/Humans", typeof(GameObject))); break; } point.SetActive(false); return(point); }
/// <summary> /// Creates a building in the given position. /// </summary> /// <returns>The building, if the position is available for /// construction, or <code>null</code>.</returns> /// /// <param name="position">The position of the building.</param> /// <param name="rotation">The rotation of the building.</param> /// <param name="type">The type of building.</param> /// <param name="race">The race this building belongs to.</param> public GameObject createBuilding(Vector3 position, Quaternion rotation, Storage.BuildingTypes type, Storage.Races race, bool checkFow, float yOffset = 0) { GameObject obj = null; position.y += yOffset; position = grid.discretizeMapCoords(position); if (grid.isNewPositionAbleForConstrucction(position, checkFow)) { position.y -= yOffset - 0.1f; obj = Storage.Info.get.createBuilding(race, type, position, rotation); if (type == Storage.BuildingTypes.STRONGHOLD) { grid.reservePositionForStronghold(position); } grid.reservePosition(position); } return(obj); }
public virtual void Start() { //moves the revealer to the orbitating position transform.position = transform.parent.position; _race = transform.parent.GetComponent <Barrack>().getRace(); //_attacker = transform.parent.GetComponent<Unit>(); _revealer = GetComponent <FOWEntity>(); _revealer.Activate(_race); _light = transform.parent.FindChild("LightHouse-Detector").gameObject; _attacker = transform.parent.FindChild("LightHouse-Detector").GetComponent <Unit>(); _light.SetActive(false); transform.parent.GetComponent <Barrack>().register(Barrack.Actions.BUILDING_FINISHED, OnBuildingFinished); transform.parent.GetComponent <Barrack>().register(Barrack.Actions.DESTROYED, OnBuildingDestroyed); _target = null; }
public virtual void Start() { //moves the revealer to the orbitating position transform.position = transform.parent.position; _race = transform.parent.GetComponent<Barrack>().getRace(); //_attacker = transform.parent.GetComponent<Unit>(); _revealer = GetComponent<FOWEntity>(); _revealer.Activate(_race); _light = transform.parent.FindChild("LightHouse-Detector").gameObject; _attacker = transform.parent.FindChild("LightHouse-Detector").GetComponent<Unit>(); _light.SetActive(false); transform.parent.GetComponent<Barrack>().register(Barrack.Actions.BUILDING_FINISHED, OnBuildingFinished); transform.parent.GetComponent<Barrack>().register(Barrack.Actions.DESTROYED, OnBuildingDestroyed); _target = null; }
public Squad(Storage.Races race, bool smellEnemies = true) { _auto = new AutoUnregister(this); _race = race; _data.Add(DataType.BOUNDING_BOX, new BoundingBox(this)); _data.Add(DataType.ATTACK_VALUE, new AttackValue(this)); _data.Add(DataType.PATROL_DATA, new PatrolData(this)); _data.Add(DataType.ASSIST_DATA, new AssistData(this)); // Smelled squads can not smell enemies or we would run into endless recursion if (smellEnemies) { _maxAttackRange = Storage.Info.get.of(_race, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest; _data.Add(DataType.SMELLED_ENEMIES, new SmelledEnemies(this)); } else { _maxAttackRange = 1f; } }
public PlayerInformation(Storage.Races race) { _race = race; buildings = new List<PlayableEntity>(); units = new List<PlayableEntity>(); resources = new ResourceAmount(); }
/// <summary> /// Enables the FOWEntity to start working as so. /// If you have the owner of this entity you should call it with Activate(owner) /// </summary> public void Activate(Storage.Races race) { GameObject gameInformationObject = GameObject.Find("GameInformationObject"); Activate(race == gameInformationObject.GetComponent <GameInformation>().GetPlayerRace()); }
/// <summary> /// Returns the building of the spcedified type /// </summary> /// <param name="race"></param> /// <param name="type"></param> /// <returns></returns> private GameObject CreateFinalBuilding(Storage.Races race, Storage.BuildingTypes type) { return(Storage.Info.get.createBuilding(race, type)); }
/// <summary> /// Returns the ghost building of the specified type /// </summary> /// <param name="race"></param> /// <param name="type"></param> /// <returns></returns> private GameObject CreateGhostBuilding(Storage.Races race, Storage.BuildingTypes type) { GameObject ghost = Storage.Info.get.createBuilding(race, type, new Vector3(0, 0, 0), Quaternion.identity, Storage.Info.BuildingVariant.GHOST); return(ghost); }
public bool isAffordable(Storage.Races race, Storage.BuildingTypes type) { Storage.BuildingInfo i = Storage.Info.get.of(race, type); return(ResourcesPlacer.get(BasePlayer.player).enoughResources(i.resources)); }
/// <summary> /// Setter for the race /// </summary> /// <param name="race"></param> public void SetRace(Storage.Races race) { _ownRace = race; }
public void Initialize(Storage.Races race) { _squad = new Squad(race); }