public void Enter() { unit.aimmingControl.Stop(); unit.unitDriver.Stop(true); if (!BattleConfig.DEAD_UNIT_COLLISION) { unit.gridCorrect.ClearSlefGrid(); } RenderHelper.ChangeWholeModelColor(unit.gameObject, Color.gray); unit.gameObject.GetComponent <TankSpineAttach> ().Deattach(); if (BattleGame.instance.mapCamera.cameraControl.IsPointInsideCamera(unit.transform.position)) { BattleGame.instance.mapCamera.cameraControl.Shake(); } AudioGroup.Play(unit.GetComponent <AudioGroup> ().dead, unit.gameObject); GameObject explode = ResourceHelper.Load(AppConfig.FOLDER_PROFAB_EFFECT_EXPLODE + "Tank_Destroy"); explode.transform.position = unit.transform.position; // BattleFactory.AddUnitToLayer (explode, BattleConfig.LAYER.EFFECT); // unit.unitDriver.engine.StopEffect(); }
public void UpdateShowTile() { if (!AppConfig.SHOW_TILE) { return; } int n = _grids.Length; for (int i = 0; i < n; ++i) { GameObject tile = _tileObjects[i]; if (_gridsPathLeftTick[i] > 0) { --_gridsPathLeftTick[i]; } float r = 0.1f + _grids[i] * 0.3f; float g = 0.1f + 0.9f * _gridsPathLeftTick[i] / SHOW_PATH_TICK_MAX; float b = 0.1f; Color color = new Color(r, g, b); RenderHelper.ChangeWholeModelColor(tile, color); } }
private void CreateEffect() { AudioGroup.Play(GetComponent <AudioGroup> ().hit, gameObject); if (BattleGame.instance.mapCamera.cameraControl.IsPointInsideCamera(gameObject.transform.position)) { BattleGame.instance.mapCamera.cameraControl.Shake(); } GameObject effectObj = GameObject.Instantiate(explode) as GameObject; RenderHelper.ChangeWholeModelColor(effectObj, Color.red); effectObj.transform.position = new Vector3(transform.position.x, 1, transform.position.z); }
public void Init(InstanceUnit unit, DataConfig.TEAM team, Vector3 fightPos, int slotIndex) { this._unit = unit; this._team = team; gameObject.transform.position = fightPos; _slotIndex = slotIndex; if (team == DataConfig.TEAM.ENEMY) { RenderHelper.ChangeWholeModelColor(gameObject, Color.blue); } TankSpineAttach spine = GetComponent <TankSpineAttach> (); if (spine != null) { spine.Attach(gameObject, unit.dataUnit.asset); } }