void Start() { testshit = Object.FindObjectOfType <Testshit>(); ui_manager = Object.FindObjectOfType <ListController>(); deployUiElement = ui_manager.AddUiElement( Resources.Load <Sprite>("Sprites/" + component.deployPrototype), component.deployPrototype, cancel => { if (!cancel) { testshit.DeployCommand(GetComponent <EntityMirror>(), // Truck deploys in place. Vector3.zero); } }); }
void Start() { testshit = Object.FindObjectOfType <Testshit>(); ui_manager = Object.FindObjectOfType <ListController>(); deployUiElement = ui_manager.AddUiElement( Resources.Load <Sprite>("Sprites/" + component.towerPrototype), component.towerPrototype, cancel => { if (!cancel) { testshit.BeginPlacement(component.towerPrototype, point => testshit.DeployCommand(GetComponent <EntityMirror>(), point), point => component.CheckBuildPlacement((Game.DVector3)point), () => {}); } }); }
void Start() { testshit = Object.FindObjectOfType <Testshit>(); buildables = new List <Buildable>(); ui_manager = Object.FindObjectOfType <ListController>(); for (var i = 0; i < component.buildables.Length; i += 1) { if (component.buildables[i] == null) { continue; } var name = component.buildables[i]; var buildable = new Buildable(); buildable.name = name; buildable.id = i; buildable.uiElement = ui_manager.AddUiElement(Resources.Load <Sprite>("Sprites/" + name), name, (cancel) => DoBuild(buildable, cancel)); buildables.Add(buildable); } }
void Start() { if (entity == null) { return; } rb = GetComponent <Rigidbody>(); testshit = Object.FindObjectOfType <Testshit>(); if (parent == null) { children = new EntityMirror[9]; for (var i = 0; i < 9; i += 1) { var x = i / 3 - 1; var z = i % 3 - 1; if (x == 0 && z == 0) { children[i] = this; } else { var go = Instantiate(gameObject); var mirror = go.GetComponent <UnityInterwork.EntityMirror>(); mirror.entity = entity; mirror.positionAdjust = new Vector3(x * 1024, 0, z * 1024); mirror.parent = this; children[i] = mirror; } } foreach (var comp in entity.components) { if (comp is Game.Factory) { var m = gameObject.AddComponent <FactoryMirror>(); m.component = (Game.Factory)comp; } else if (comp is Game.ResourceSource) { var m = gameObject.AddComponent <ResourceSourceMirror>(); m.component = (Game.ResourceSource)comp; } else if (comp is Game.ResourcePool) { var m = gameObject.AddComponent <ResourcePoolMirror>(); m.component = (Game.ResourcePool)comp; } else if (comp is Game.Wizard) { var m = gameObject.AddComponent <WizardMirror>(); m.component = (Game.Wizard)comp; } else if (comp is Game.Truck) { var m = gameObject.AddComponent <TruckMirror>(); m.component = (Game.Truck)comp; } else if (comp is Game.Collider) { var m = gameObject.AddComponent <ColliderMirror>(); m.component = (Game.Collider)comp; } else if (comp is Game.ProjectileWeapon) { var m = gameObject.AddComponent <ProjectileWeaponMirror>(); m.component = (Game.ProjectileWeapon)comp; } else if (comp is Game.HitscanWeapon) { var m = gameObject.AddComponent <HitscanWeaponMirror>(); m.component = (Game.HitscanWeapon)comp; } else if (comp is Game.Health) { var m = gameObject.AddComponent <HealthMirror>(); m.healthBarPrefab = healthBarPrefab; m.canvasTransform = Object.FindObjectOfType <PlayerInterface>().screenCanvas; m.component = (Game.Health)comp; } else if (comp is Game.ResourceHarvester) { var m = gameObject.AddComponent <ResourceHarvesterMirror>(); m.resourceBarPrefab = resourceBarPrefab; m.canvasTransform = Object.FindObjectOfType <PlayerInterface>().screenCanvas; m.component = (Game.ResourceHarvester)comp; } else if (comp is Game.PartialBuilding) { var m = gameObject.AddComponent <PartialBuildingMirror>(); m.resourceBarPrefab = resourceBarPrefab; m.canvasTransform = Object.FindObjectOfType <PlayerInterface>().screenCanvas; m.component = (Game.PartialBuilding)comp; // Don't do the death animation. rb = null; } else if (comp is Game.WizardTower) { var m = gameObject.AddComponent <WizardTowerMirror>(); m.component = (Game.WizardTower)comp; } else if (comp is Game.BuildRadius) { var m = gameObject.AddComponent <BuildRadiusMirror>(); m.component = (Game.BuildRadius)comp; } else if (comp is Game.BasicUnit) { var m = gameObject.AddComponent <BasicUnitMirror>(); m.component = (Game.BasicUnit)comp; } else { Logger.Log("Unmirrorable component {0}", comp); } } } else { // eugh foreach (var comp in entity.components) { if (comp is Game.Health) { var m = gameObject.AddComponent <HealthMirror>(); m.healthBarPrefab = healthBarPrefab; m.canvasTransform = Object.FindObjectOfType <PlayerInterface>().screenCanvas; m.component = (Game.Health)comp; } else if (comp is Game.ResourceHarvester) { var m = gameObject.AddComponent <ResourceHarvesterMirror>(); m.resourceBarPrefab = resourceBarPrefab; m.canvasTransform = Object.FindObjectOfType <PlayerInterface>().screenCanvas; m.component = (Game.ResourceHarvester)comp; } else if (comp is Game.PartialBuilding) { var m = gameObject.AddComponent <PartialBuildingMirror>(); m.resourceBarPrefab = resourceBarPrefab; m.canvasTransform = Object.FindObjectOfType <PlayerInterface>().screenCanvas; m.component = (Game.PartialBuilding)comp; // Don't do the death animation. rb = null; } } } UpdateTeamColour(); transform.position = (Vector3)entity.position; transform.eulerAngles = new Vector3(0, (float)entity.rotation, 0); interpolationTime = 0; nextTick = Game.World.current.currentTick; currentPosition = transform.position; nextPosition = currentPosition; currentRotation = new Vector3(0, (float)entity.rotation, 0); nextRotation = currentRotation; }
void Start() { testshit = Object.FindObjectOfType <Testshit>(); navMesh = Object.FindObjectOfType <Testshit>().navi; uiManager = Object.FindObjectOfType <ListController>(); }
void Start() { testshit = Object.FindObjectOfType <Testshit>(); }