public Unit(string _type, TeamColor _color, int _road) : this(_color, _road - 1) { type = _type; size = new Vector2(1.5f, 1.5f) * Settings.FhdToHD; if (UnitsSettings.Buffs(type).Contains("Boss")) { size = new Vector2(3f, 3f) * Settings.FhdToHD; } healthBarDeltaPosition = UnitsSettings.HealthBarPosition(_type) / 4f * Settings.FhdToHD; //new Vector2 (0, 0.7f); shadowDeltaPosition = UnitsSettings.ShadowPosition(_type) / 4f * Settings.FhdToHD; //new Vector2 (0.1f, -0.575f);; try { healthMax = BalanceSettings.health [_type]; speed = BalanceSettings.speed [_type]; damage = BalanceSettings.damage [_type]; goldReward = BalanceSettings.price [_type]; defence = BalanceSettings.defence [_type]; } catch (System.Exception e) { Debug.LogError("Wrong" + type); } objectAnimation.Load(_type + "Walk", -0.6f); objectAnimation.Play(-2); }
public void Click() { if (OnClickAnimation != "") { animation.Load(OnClickAnimation, -OnClickAnimationTime); animation.Play(-1, () => { OnClick(this); }); } else { if (OnClick != null) { OnClick(this); } } }
protected void AttackAnimation() { if (AnimationBox.Contains(attackAnimaton)) { animation.Load(attackAnimaton, -attackAnimatonTime); animation.Play(-1); } else { Debug.LogWarning("No attack animation: " + attackAnimaton); } }
public Bomb(Vector2 position) { gameObject = GamePullController.CreateImage(); texture = Resources.Load("Textures/UserInterface/Bomb") as Texture; animation = new ObjectAnimation(gameObject); animation.Load("Bomb"); animation.Play(-2); size = new Vector2(1, 1); mapPosition = position; layer = 0.5f; BombsController.bombs.Add(this); }