public whaleWithState(GameObject w, objectState s, Vector3 targetPosition, Vector3 diveTargetPosition) { whale = w; state = s; targetPos = targetPosition; diveTargetPos = diveTargetPosition; }
public override void Act() { objectState state = element.getState(); switch (state) { case objectState.DEFAULT: GameManager.instance.addItemToInv(item1); SRManager.instance.playTTS(pickUpLine1); element.setState(objectState.USED); GameManager.instance.SaveData(); break; case objectState.USED: GameManager.instance.addItemToInv(item2); SRManager.instance.playTTS(pickUpLine2); element.setState(objectState.USED2); GameManager.instance.SaveData(); break; case objectState.USED2: SRManager.instance.playTTS(emptyLine); break; default: break; } }
// Use this for initialization void Start() { oState = GetComponent <objectState> (); cube = transform.GetChild(2).gameObject; cube.GetComponent <objectState> ().parent = oState.parent; // transfering parent cube.SetActive(false); }
void OnCollisionEnter(Collision collision) //FOR WHEN OBJECTS HIT EACH OTHER { if (collision.rigidbody != null && !collision.gameObject.CompareTag("Explosive")) { if (root == true) { //Debug.Log(collision.gameObject); if (collision.rigidbody.velocity.magnitude > 0.5f && timeTrigger == true) { timeSave = Time.time; transform.GetChild(0).gameObject.SetActive(true); //Activates the HealthBar.cs script. if (transform.GetComponentInChildren <HealthBar>() != null) { transform.GetComponentInChildren <HealthBar>().ActivateHealthBar(); } //Debug.Log(currentDurability); //Debug.Log(GetComponent<Rigidbody>().velocity.magnitude); collision.gameObject.GetComponent <Properties>().currentDurability -= collision.rigidbody.velocity.magnitude; //Object hitting. currentDurability -= GetComponent <Rigidbody>().velocity.magnitude; //Debug.Log(currentDurability); if (GetComponent <AudioSource>() != null) { sfxController.GetComponent <sfxcontroller>().AddDestructible(gameObject); //SFX } timeTrigger = false; } if (Time.time >= timeSave + .5f) //Can only cause Damage to an object in a .5sec period. After .5Sec, it can Damage it again. { timeTrigger = true; } if (currentDurability < 0) { currentDurability = 0; } if (currentDurability <= 0 && objectstate == objectState.state1) { objectstate = objectState.state3; particles = true; gameObject.GetComponent <SwitchPrefab>().Switch2(particles); } else if (currentDurability < initialDurability * middleDamage && objectstate == objectState.state1) { objectstate = objectState.state2; gameObject.GetComponent <SwitchPrefab>().Switch1(); } else if (currentDurability <= 0 && objectstate == objectState.state2) { objectstate = objectState.state3; gameObject.GetComponent <SwitchPrefab>().Switch2(particles); } } } }
public void trigger() { state.changeColor(Color.cyan); objectState oState = GetComponent <objectState> (); oState.parent.triggered = true; oState.triggered = true; }
private void Start() { oState = GetComponent <objectState> (); try { oState.changeColor(oState.child.changeColor()); } catch { print("couldn't set color for " + name); } }
void OnCollisionExit(Collision col) { if (objectTriggers && col.transform.tag == "cube") { objectState oState = GetComponent <objectState> (); oState.parent.triggered = false; oState.triggered = false; } }
void Start() { state = GetComponent <objectState> (); a = transform.GetChild(0); b = transform.GetChild(1); c = transform.GetChild(2); while (isSameAngle()) { scrambleRotation(); } }
void Start() { CanvasController = GameObject.Find("TextCanvas").GetComponent <CanvasController> (); mapController = GameObject.FindWithTag("GameController").GetComponent <MapController> (); pBehavauir = GameObject.FindWithTag("GameController").GetComponent <PlayerBehavouir> (); connectedToPuzzle = false; // connectedToStory = false; locked = true; setColor(Color.grey); state = GetComponent <objectState> (); StartCoroutine(connectToPuzzle()); }
void Start() { mapController = GameObject.FindWithTag("GameController").GetComponent <MapController> (); connectedToPuzzle = false; locked = true; setColor(Color.grey); state = GetComponent <objectState> (); if (state.child != null) { print("Door has been connected to puzzle"); } StartCoroutine(connectToPuzzle()); }
public void DealDamage(float damage, GameObject bomb) { if (explosives.Contains(bomb) == false && gameObject.tag == "Destructible") //If the explosive affected it, don't do damage again with the same one. { explosives.Add(bomb); //Add the explosive's GameObject to the list. if (root == true) { if (transform.GetChild(0) != null) { if (transform.GetChild(0).gameObject != null) { transform.GetChild(0).gameObject.SetActive(true); //Activates the HealthBar.cs script. } } if (transform.GetComponentInChildren <HealthBar>() != null) { transform.GetComponentInChildren <HealthBar>().ActivateHealthBar(); } currentDurability -= damage; //Decrease the item's durability. if (currentDurability < 0) { currentDurability = 0; } //Debug.Log(currentDurability); //Check durability. (DEBUGGING) //Debug.Log(initialDurability); //Check durability. (DEBUGGING) if (GetComponent <AudioSource>() != null) { sfxController.GetComponent <sfxcontroller>().AddDestructible(gameObject); //SFX } if (currentDurability <= 0 && objectstate == objectState.state1) { objectstate = objectState.state3; particles = true; gameObject.GetComponent <SwitchPrefab>().Switch2(particles); } else if (currentDurability < initialDurability * middleDamage && objectstate == objectState.state1) { objectstate = objectState.state2; gameObject.GetComponent <SwitchPrefab>().Switch1(); } else if (currentDurability <= 0 && objectstate == objectState.state2) { objectstate = objectState.state3; gameObject.GetComponent <SwitchPrefab>().Switch2(particles); } } } }
int frame; // current frame of object public Fire(Game1 game, Vector2 position, int width, int height, int widthOfFrame, int heightOfFrame, float speed) { this.game = game; this.position = position; this.FRAME_WIDTH = widthOfFrame; this.FRAME_HEIGHT = heightOfFrame; this.OBJECT_SPEED = speed; origin = new Vector2(0, 0); this.bounds.Width = width; this.bounds.Height = height; state = objectState.Animate; animationTimer = new TimeSpan(0); }
public override void Act() { objectState state = element.getState(); if (state == objectState.DEFAULT) { ScreenInput.instance.deactivate(pickUpLine.length); GameManager.instance.addItemToInv(item); SRManager.instance.playTTS(pickUpLine); element.setState(objectState.USED); GameManager.instance.SaveData(); } else if (state == objectState.USED) { SRManager.instance.playTTS(emptyLine); } }
public override void Act() { objectState state = element.getState(); if (state == objectState.DEFAULT) { if (srm.inventory.ContainsObjectByName(itemRequired)) { srm.playTTS(successString); srm.deactivate(successString.length); //cargar nueva escena (con invoke, para que de tiempo a oir el texto) Invoke("effectSound", successString.length); } else { srm.playTTS(failString); } } else if (state == objectState.USED) { srm.playTTS(usedString); } }
public void setState(objectState stat) { state = stat; }
// Use this for initialization void Start() { state = GetComponent <objectState> (); }
private void OnEnable() { State = objectState.over; EditorInitialization.EditorData.MapObject.Add(gameObject); }
private void Awake() { State = objectState.over; }
private void OnMouseDown() { State = State == objectState.over ? objectState.used : objectState.over; }
void Start() { GameObject obsRoot, tarRoot, droneRoot; obsRoot = new GameObject("obs"); tarRoot = new GameObject("tars"); droneRoot = new GameObject("drons"); startStateStream = new MemoryStream(); string path = System.DateTime.Now.ToFileTimeUtc().ToString() + ".xml"; Dictionary <string, string> x; System.IO.StreamWriter outputStream = new StreamWriter(startStateStream); XmlSerializer serializer = new XmlSerializer(typeof(List <objectState>), new [] { typeof(visibleObjectState), typeof(uavObjectState), typeof(List <KeyValuePair <string, string> >) }); tarCount = targetCount; obs = new GameObject[obsCount]; drones = new GameObject[droneCount]; tar = new GameObject[targetCount]; List <objectState> stateList = new List <objectState>(); for (int i = 0; i < obsCount; i++) { Vector3 randomPoint = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), Random.Range(minZ, maxZ)); objectState state = new objectState(); state.position = randomPoint; state.name = "obs " + i.ToString(); obs[i] = state.createGameObject(obsRoot.transform); // state.reportState(ref outputStream); stateList.Add(state); } for (int i = 0; i < targetCount; i++) { Vector3 randomPoint = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), Random.Range(minZ, maxZ)); visibleObjectState state = new visibleObjectState("tar " + i.ToString(), "Cube"); state.position = randomPoint; tar[i] = state.createGameObject(tarRoot.transform); stateList.Add(state); } Dictionary <string, string> uavData = new Dictionary <string, string>(); uavData["mass"] = "1"; string [] cmdList = new string[3]; cmdList[1] = "goToObject s1"; cmdList[2] = "move x200 y13 z200"; cmdList[0] = "setSpeed 30"; for (int i = 0; i < droneCount; i++) { Vector3 randomPoint = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), Random.Range(minZ, maxZ)); uavObjectState state = new uavObjectState("drone " + i.ToString(), "simpleDrone"); state.position = randomPoint; state.uavData = uavObjectState.makeListFromDictionary(uavData); state.cmdList = cmdList; drones[i] = state.createGameObject(droneRoot.transform); stateList.Add(state); } serializer.Serialize(outputStream, stateList); outputStream.Flush(); writeSimultionStartState(path); // startStateStream; }
public element(string s, int o) { prefabName = s; state = (objectState)o; }
public element(string s, objectState o) { prefabName = s; state = o; }
void Start() { estadoIni = new objectState(getActivePower(), getActivePosition(), getActiveRotation()); }