/// <summary> /// Triggers an animation that moves the real and cell position of this dweller to the specified /// cell. Duration is the length of the animation in seconds. Delay is the amount of time to /// wait before starting the animation. Acceleration is an exponent to apply to smooth the /// animation. A value of 1.0 will result in a linear animation, anything greater than that will /// make the animation smoother (but it will take the same amount of time.) public void AnimateToCell( CellPosition position, float duration, float delay = 0.0f, float acceleration = 1.0f ) { animTimer = 0.0f; animDelay = delay; animDuration = duration; animAcceleration = acceleration; animStart = gameObject.transform.position; animEnd = dwellsOn.GetRealPosition(position); animating = true; }
void Start() { gridWorld = GridWorld.getInstance(); allCells = gridWorld.ListAllCells(); foreach (CellPosition cell in allCells) { PhysicalCell physicalCell = new PhysicalCell(); physicalCell.position = gridWorld.GetRealPosition(cell); Instantiate(cellPrefab, physicalCell.position); /* * if (optionalPlayerEffect != null) { * GameObject playerEffect = Instantiate(optionalPlayerEffect, physicalCell.position); * physicalCell.playerEffect = playerEffect.GetComponentInChildren<ParticleSystem>(); * physicalCell.playerEffect.Stop(); * } * * if (optionalEnemyEffect != null) { * GameObject enemyEffect = Instantiate(optionalEnemyEffect, physicalCell.position); * physicalCell.enemyEffect = enemyEffect.GetComponentInChildren<ParticleSystem>(); * physicalCell.enemyEffect.Stop(); * } */ foreach (DwellerInfo info in dwellerInfoSet) { physicalCell.data.Add(info.type, new PhysicalCell.TypeSpecificData()); if (info.optionalEffect != null) { GameObject effect = Instantiate(info.optionalEffect, physicalCell.position); physicalCell.data[info.type].effect = effect.GetComponentInChildren <ParticleSystem>(); physicalCell.data[info.type].effect.Stop(); } } physicalCells.Add(physicalCell); } }