// Update is called once per frame public void summonToField(GameObject ObjectToCopy) { // if (counter == 0) // { Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(true); Collider[] colliderComponents = GetComponentsInChildren <Collider>(true); // Enable rendering: foreach (Renderer component in rendererComponents) { // A print statement here prints out multiple times as long as card is in view //Debug.Log(mTrackableBehaviour.TrackableName + " is on the field"); component.enabled = true; } // Enable colliders: foreach (Collider component in colliderComponents) { component.enabled = true; } this.SpawnObject = ObjectToCopy; SpawnPoint = GameObject.Find("Spawn"); // add a function that allocates spawn location int spawn_state = 1; GameObject tempGameObject; tempGameObject = Instantiate(this.SpawnObject, this.SpawnPoint.transform.position, this.SpawnPoint.transform.rotation) as GameObject; tempGameObject.transform.parent = this.transform; // ---------------------------- Temporary Code (Must Replace in Future Development ----------------------------- // Only for Blue Eyes (future work is to have an external script to call from that will store values) tempGameObject.transform.localScale = new Vector3(0.01F, 0.01F, 0.01F); GameObject Kuribo_temp = GameObject.Find("DE_temp"); // Uses temp Kuribo as GameObject, must remove as soon as possible //batManage = GetComponent("battleManage") as battleManage; MonsterTraits spawn_trait = tempGameObject.GetComponent("MonsterTraits") as MonsterTraits; spawn_trait.cslot = spawn_state; //GameObject master_ob = GameObject.Find("MasterObject"); MasterControl master_ctrl = GameObject.Find("MasterObject").GetComponent("MasterControl") as MasterControl; Debug.Log("master_ctrl is: " + master_ctrl); master_ctrl.engageBattlePhase(tempGameObject, Kuribo_temp); //batManage.battlePhase(tempGameObject, Kuribo_temp); // ---------------------------------------------------------------------------------------------- }
// Use this for initialization public void battlePhase(GameObject attacker_i, GameObject defender_i) { // Turning our input GameObjects into our global variables attacker = attacker_i; defender = defender_i; //GameObject summon = attacker.transform.FindChild("Summon").gameObject; //Debug.Log("Summoning animation: " + summon); //summon.SetActive(true); //mShowGUIButton = true; // Entering battle phase (monster is preparing an attack) MonsterTraits attacker_traits = attacker.GetComponent("MonsterTraits") as MonsterTraits; MonsterTraits defender_traits = defender.GetComponent("MonsterTraits") as MonsterTraits; Debug.Log(attacker_traits.real_name + " is now attacking " + defender_traits.real_name); // Assuming the defender is in attack mode if (attacker_traits.atk > defender_traits.atk) { attackAnimations("Attack_Success"); // Commence attack animations // If attacker is stronger than defender Debug.Log(attacker_traits.real_name + " destroyed " + defender_traits.real_name + "!"); Debug.Log("Opponent lost " + (attacker_traits.atk - defender_traits.atk) + "LP!"); // Explosions int explosion_slot = defender_traits.cslot; } else if (attacker_traits.atk == defender_traits.atk) { // If attacker and defender are equal Debug.Log(attacker_traits.real_name + " and " + defender_traits.real_name + "were both destoryed!"); } else if (attacker_traits.atk < defender_traits.atk) { // If attacker is weaker than defender Debug.Log(attacker_traits.real_name + " was destroyed by " + defender_traits.real_name + "!"); Debug.Log("You lost " + (defender_traits.atk - attacker_traits.atk) + "LP!"); int explosion_slot = attacker_traits.cslot; } }
public MonsterPlaceHolder(MonsterTraits traits) { traits_ = traits; }