public void DeployUnit(UnitSpawnPos targetPos, Squad targetSquad) { attachedSquad = targetSquad; _spawningParticles = PoolMaster.SpawnRandomReference("PS_Deploying", this.transform.position).GetComponent<ParticleSystem>(); _spawningParticles.transform.SetParent(this.transform); _spawningParticles.Play(); spawnPos = targetPos; this.transform.position = spawnPos.GetPos() + Vector3.up * 100; iTween.MoveTo(this.gameObject, iTween.Hash( "position", targetPos.GetPos(), "time", Random.Range(1f,2f), "isLocal",true , "easetype", iTween.EaseType.linear, "oncomplete", "DeploymentComplete")); }
public void Awake() { _squadIdNo = int.Parse(transform.parent.name.Substring(transform.parent.name.Length - 3, 3)); _rangeCol = GetComponentInChildren<SphereCollider>(); _squadMapSymbol = gameObject.GetComponentInChildren<SquadMapSymbol>(); foreach (UnitSpawnPos usp in gameObject.GetComponentsInChildren<UnitSpawnPos>()) { if (usp.squadLeaderPos) _squadLeaderPos = usp; else _unitPositions.Add(usp); } _unitPositions.AddRange(gameObject.GetComponentsInChildren<UnitSpawnPos>()); _navAgent = this.transform.parent.GetComponentInChildren<NavMeshAgent>(); }