public override void Process(AGE.Action _action, Track _track) { Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); GameObject gameObject = _action.GetGameObject(this.srcId); GameObject inDest = _action.GetGameObject(this.destId); if ((gameObject == null) && (hostPlayer.Captain != 0)) { gameObject = hostPlayer.Captain.handle.gameObject; } if (gameObject != null) { if (this.MyPathIndicator == null) { this.MyPathIndicator = UnityEngine.Object.FindObjectOfType <PathIndicator>(); } if (this.MyPathIndicator != null) { if (this.bPlay) { this.MyPathIndicator.Play(gameObject, inDest, ref this.TargetPos); } else { this.MyPathIndicator.Stop(); } } } this.MyPathIndicator = null; }
public override void Process(Action _action, Track _track) { Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); GameObject gameObject = _action.GetGameObject(this.srcId); GameObject gameObject2 = _action.GetGameObject(this.destId); if (!gameObject && hostPlayer.Captain) { gameObject = hostPlayer.Captain.handle.gameObject; } if (gameObject) { if (this.MyPathIndicator == null) { this.MyPathIndicator = Object.FindObjectOfType <PathIndicator>(); } if (this.MyPathIndicator) { if (this.bPlay) { this.MyPathIndicator.Play(gameObject, gameObject2, ref this.TargetPos); } else { this.MyPathIndicator.Stop(); } } } this.MyPathIndicator = null; }
private void Start() { //CreateParticleSystemForAllEmployees(idlePS, idlePSList); //CreateParticleSystemForAllEmployees(runningPS, runningPSList); for (int i = 0; i < TouchInput.Instance.MaxTouches; i++) { //Initialise a new path indicator on start PathIndicator pathIndicator = new PathIndicator(); //Instantiate the prefab pathIndicator.instance = Instantiate(pathIndicatorPrefab, transform); //Assign script references pathIndicator.drawArrow = pathIndicator.instance.GetComponent <DrawArrow>(); //Assign touch reference pathIndicator.touchRef = TouchInput.Instance.playerTouches[i]; pathIndicator.drawArrow.lr.material = arrowMat; //Disable the object by default pathIndicator.instance.SetActive(false); pathIndicators.Add(pathIndicator); } //This will need modifying to allow for the path indicators }
protected override void CopyData(BaseEvent src) { base.CopyData(src); GuidePathIndicatorTick tick = src as GuidePathIndicatorTick; this.srcId = tick.srcId; this.atkerId = tick.atkerId; this.destId = tick.destId; this.TargetPos = tick.TargetPos; this.bPlay = tick.bPlay; this.MyPathIndicator = tick.MyPathIndicator; }
private IEnumerator SelectedWaypoint_EnterState(object input) { selectedWaypoint = (GameObject)input; selectedPathRenderer = selectedWaypoint.transform.parent.GetComponent <LineRenderer>(); selectedPathIndicator = selectedPathRenderer.transform.GetComponentInChildren <PathIndicator>(); selectedPathIdx = selectedPathRenderer.transform.GetSiblingIndex(); selectedWaypointIdx = selectedWaypoint.transform.GetSiblingIndex(); glowEffect.Enable(selectedWaypoint); yield return(null); }
public IEnumerator LoadLevel(LevelFile level, bool addWaypoints = false) { towerSpotParent = new GameObject("TowerSpots").transform; for (int i = 0; i < level.towerSpots.Count; ++i) { Vector2 position = level.towerSpots[i].position; Vector2 scale = level.towerSpots[i].scale; scale *= towerSpotPrefab.CellSize; Transform towerSpot = Instantiate(towerSpotPrefab, towerSpotParent).transform; Vector3 localPosition = towerSpot.localPosition; Vector3 localScale = towerSpot.localScale; localPosition = new Vector3(position.x, localPosition.y, position.y); localScale = new Vector3(scale.x, localScale.y, scale.y); towerSpot.localPosition = localPosition; towerSpot.localScale = localScale; yield return(null); } pathsParent = new GameObject("Paths").transform; for (int i = 0; i < level.paths.Count; ++i) { LineRenderer pathRenderer = Instantiate(pathRendererPrefab, pathsParent); PathIndicator pathIndicator = Instantiate(pathIndicatorPrefab, pathRenderer.transform); pathRenderer.name = i.ToString(); Vector3[] waypoints = level.paths[i].Waypoints3D; if (addWaypoints) { yield return(StartCoroutine(AddWaypoints(pathRenderer.transform, waypoints))); } pathRenderer.positionCount = waypoints.Length; pathRenderer.SetPositions(waypoints); pathIndicator.SetWaypoints(waypoints); yield return(null); } }
public override void OnUse() { base.OnUse(); this.MyPathIndicator = null; }
void DrawArrowManage() { for (int i = 0; i < pathIndicators.Count; i++) { if (!pathIndicators[i].touchRef.tracking) { //If the startpoint is set, trigger the particle system if (pathIndicators[i].drawArrow.startPointSet) { GameObject currentEmployee = pathIndicators[i].drawArrow.target; //Initialise a new path indicator on start PathIndicator employeePath = new PathIndicator(); employeePath.instance = Instantiate(pathIndicatorPrefab, transform); employeePath.drawArrow = employeePath.instance.GetComponent <DrawArrow>(); employeePath.drawArrow.targetEmployee = pathIndicators[i].drawArrow.targetEmployee; employeePath.drawArrow.endDragLoc = pathIndicators[i].drawArrow.endDragLoc; employeePath.drawArrow.startPointSet = pathIndicators[i].drawArrow.startPointSet; employeePath.drawArrow.endPointSet = true; employeePath.instance.transform.position = currentEmployee.transform.position; employeePaths.Add(employeePath); pathIndicators[i].drawArrow.Reset(); pathIndicators[i].instance.transform.position = Vector3.zero; pathIndicators[i].instance.SetActive(false); } } //If it's not active, set it active if (!pathIndicators[i].instance.activeInHierarchy) { pathIndicators[i].instance.SetActive(false); } //update the positions here using pathIndicators[i].touchRef.worldStart/End and the references to the scripts if (pathIndicators[i].touchRef.tracking) { pathIndicators[i].instance.SetActive(true); pathIndicators[i].drawArrow.targetEmployee = pathIndicators[i].touchRef.selectedChar; PlayParticleSystemOnEmployee(pathIndicators[i].drawArrow.targetEmployee.gameObject, pulsePSList); pathIndicators[i].drawArrow.endDragLoc = pathIndicators[i].touchRef.worldEnd; pathIndicators[i].drawArrow.startPointSet = true; //print("Drawing line!!! Start:" + pathIndicators[i].drawArrow.startloc + ", End: " + pathIndicators[i].drawArrow.endLoc); } } for (int i = 0; i < employeePaths.Count; i++) { //End the loop if (employeePaths[i].drawArrow.reached) { GameObject currentEmployee = employeePaths[i].drawArrow.target; PathIndicator employeePath = employeePaths[i]; employeePath.drawArrow.Reset(); employeePaths.Remove(employeePath); employeePath.instance.SetActive(false); Destroy(employeePath.instance); } } }