public virtual void setWallData(WallInfo wallInfo) { maxHealth = wallInfo.maxHealth; currentHealth = wallInfo.maxHealth >= wallInfo.currentHealth ? wallInfo.currentHealth : wallInfo.maxHealth; setHealthText(); // rotate by init angle initAngle = wallInfo.initAngle; transform.Rotate(0, 0, -initAngle); initPosition = wallInfo.initPosition.GetV3(); type = wallInfo.type; if (wallInfo.movement == null || wallInfo.movement.speed <= 0) { GetComponent <WallMovement>().enabled = false; } else { GetComponent <WallMovement>().enabled = true; GetComponent <WallMovement>().SetMovementData(wallInfo.movement); } if (wallInfo.rotate == null || wallInfo.rotate.speed <= 0) { GetComponent <WallRotate>().enabled = false; } else { GetComponent <WallRotate>().enabled = true; GetComponent <WallRotate>().SetRotateData(wallInfo.rotate); } }
public WallInfo(Constants.WallTypes type, int maxHealth, int currentHealth, float initAngle, MyVector3 initPosition, WallMovementData movement, WallRotateData rotate) { this.type = type; this.initAngle = initAngle; this.initPosition = initPosition; this.maxHealth = maxHealth; this.currentHealth = currentHealth; this.movement = movement; this.rotate = rotate; }
public WallInfo(WallInfo other) { this.type = other.type; this.initPosition = other.initPosition; this.initAngle = other.initAngle; this.currentHealth = other.currentHealth; this.maxHealth = other.maxHealth; this.movement = other.movement; this.rotate = other.rotate; }