void UIAction(int what) { ComSat.Trace(this, "UIAction"); if (what < 0 || what >= constructionPrefabs.Length) { return; } var mine = constructionPrefabs[what].GetComponent <Mine>(); if (mine != null) { var sourceHere = Utility.GetThingAt <ResourceSource>(entity.position); if (sourceHere == null || sourceHere.hasMine || sourceHere.resource != mine.resource) { return; } buildPosition = sourceHere.GetComponent <Entity>().position; movable.Move(buildPosition); buildIndex = what; return; } ComSat.SpawnEntity(constructionPrefabs[what].gameObject, entity.team, entity.position, entity.rotation); ComSat.DestroyEntity(entity, DestroyReason.Tranformed); }
void Attack(Entity[] targets) { this.targets = targets; PickNewTarget(); motor.Move(target.position); }