protected override void OnInitialize() { basePriority = Agent.Body.Priority; searchCount = LSUtility.GetRandom(SearchRate) + 1; attackCount = 0; Target = null; IsAttackMoving = false; inRange = false; isFocused = false; CycleCount = 0; this.Destination = Vector2d.zero; repathTimer.Reset(repathInterval); repathRandom = LSUtility.GetRandom(repathInterval); //caching parameters var spawnVersion = Agent.SpawnVersion; var controller = Agent.Controller; CachedOnHit = (target) => OnHit(target, spawnVersion, controller); if ((Agent as RTSAgent).GetCommander() && loadedSavedValues && loadedTargetId >= 0) { RTSAgent obj = (Agent as RTSAgent).GetCommander().GetObjectForId(loadedTargetId); if (obj.MyAgentType == AgentType.Unit || obj.MyAgentType == AgentType.Building) { Target = (LSAgent)obj; } } }
protected override void OnInitialize() { basePriority = Agent.Body.Priority; constructCount = 0; CurrentProject = null; IsBuilding = false; IsBuildMoving = false; inRange = false; IsFocused = false; repathTimer.Reset(repathInterval); repathRandom = LSUtility.GetRandom(repathInterval); //caching parameters var spawnVersion = Agent.SpawnVersion; var controller = Agent.Controller; if (Agent.GetCommander() && loadedSavedValues && loadedProjectId >= 0) { RTSAgent obj = Agent.GetCommander().GetObjectForId(loadedProjectId); if (obj.MyAgentType == AgentType.Building) { CurrentProject = obj; } } }
protected override void OnInitialize() { basePriority = Agent.Body.Priority; harvestCount = 0; IsHarvesting = false; IsHarvestMoving = false; inRange = false; IsFocused = false; repathTimer.Reset(repathInterval); repathRandom = LSUtility.GetRandom(repathInterval); //caching parameters var spawnVersion = Agent.SpawnVersion; var controller = Agent.Controller; if (Agent.GetCommander() && loadedSavedValues && loadedDepositId >= 0) { RTSAgent obj = Agent.GetCommander().GetObjectForId(loadedDepositId); if (obj.MyAgentType == AgentType.Resource) { resourceTarget = obj; } } else { HarvestType = ResourceType.Unknown; } }
public virtual void OnInitialize() { cachedBody = cachedAgent.Body; cachedHealth = cachedAgent.GetAbility <Health>(); cachedMove = cachedAgent.GetAbility <Move>(); cachedTurn = cachedAgent.GetAbility <Turn>(); searchCount = LSUtility.GetRandom(SearchRate) + 1; }