private void ChangeCharacter(int index) { currentCharacterIndex = index; currentCharacter = characterDefinitionSet.GetDefinition(currentCharacterIndex); characterSpriteRenderer.sprite = currentCharacter.portrait; currentTank = currentCharacter.defaultTankDefinition; tankRepresentation.LoadTankDefinition(currentTank); characterNameText.text = currentCharacter.name; }
public void LoadTankDefinition(TankDefinition definition) { tankBase.sprite = definition.tankBase.sprite; tankTreads.sprite = definition.tankTreads.sprite; tankTurret.sprite = definition.tankTurret.sprite; tankBaseOutline.sprite = definition.tankBase.outlineSprite; tankTreadsOutline.sprite = definition.tankTreads.outlineSprite; tankTurretOutline.sprite = definition.tankTurret.outlineSprite; }
public T CreateTank <T>(TankController controller, TankDefinition definition) where T : TankManager { T tank = (T)Instantiate(defaultTank); tank.LoadTankDefinition(definition); defaultTank.controller = controller; currentTanks.Add(tank); tank.tankID = latestTankId++; return(tank); }
public void SetHull(TankDefinition definition) { center.sprite = definition.tankBase.sprite; outline.sprite = definition.tankBase.outlineSprite; var renderer = particles.GetComponent <Renderer>(); MaterialPropertyBlock block = new MaterialPropertyBlock(); renderer.GetPropertyBlock(block); block.SetTexture("_MainTex", definition.tankBase.outlineSprite.texture); renderer.SetPropertyBlock(block); }
public void LoadTankDefinition(TankDefinition tankDefinition) { this.tankDefinition = tankDefinition; tankSprite.LoadTankDefinitionSprites(tankDefinition); respawnSpriteController.SetHull(tankDefinition); var renderer = onHitParticleSystem.GetComponent <Renderer>(); MaterialPropertyBlock block = new MaterialPropertyBlock(); renderer.GetPropertyBlock(block); block.SetTexture("_MainTex", tankDefinition.tankBase.outlineSprite.texture); renderer.SetPropertyBlock(block); }