// Use this for initialization public void StartGame() { GameObject ui_holder = GameObject.Find("UI"); //Find Component classes magicController = GetComponent <MagicController>(); roundBonusManager = GetComponent <RoundBonusManager>(); global = GetComponent <GlobalFlags>(); networkedUI = ui_holder.GetComponent <Networked_UI_Updater>(); progressTrackManager = ui_holder.GetComponent <TracksInterface>(); townFoundManager = GetComponent <TownFoundingBonusManager>(); wonderController = GetComponent <WonderController>(); roundEndBonusManager = GetComponent <RoundEndBonusManager>(); turnController = GameObject.Find("TurnController(Clone)").GetComponent <TurnController>(); //Networked object so must be it's own game object separate from GameController. //Create component classes cultController = new CultController(); localPlayer = GameObject.FindWithTag("Player_Object").GetComponent <Player>(); wonderController.SetUp(); magicController.SetUpSpells(); networkedUI.SetUpUI(); progressTrackManager.SetUp(); townFoundManager.SetUp(); roundBonusManager.SetUp(); roundEndBonusManager.SetUp(); SetUpTracks(); global.Set_Up(); }
public void CastMagic() { //If Magic has been invoked if ((!MagicController.Equals(global.MagicCastFlag, MagicController.SpellType.NOTHING)) && localPlayer.CheckCanCastSpell(magicController.GetSpell((int)global.MagicCastFlag))) { if (global.MagicCastFlag == MagicController.SpellType.BURN) { localPlayer.BurnMagic(); } if ((int)global.MagicCastFlag < 3)//If it's a regular spell { localPlayer.CastSpell(magicController.GetSpell((int)global.MagicCastFlag)); } //If it's a world spell we need an extra step. //However if the player terraformed this round, deny the use of world magic if ((int)global.MagicCastFlag <= 8 && !magicController.CheckWorldMagicUsed(global.MagicCastFlag) && !endTurnOrBuild) { if (global.MagicCastFlag == MagicController.SpellType.World_Bridge) { localPlayer.CastSpell(magicController.GetSpell((int)global.MagicCastFlag)); //Cast spell to remove magic from tier 3 pool bm.AllowBridge(localPlayer.GetID()); } else { //If it's successfully casted and not a bridge, send that data to the server and gain its effects localPlayer.localPlayerObject.GetComponent <TakenTurnData>().SendCastedSpellData(global.MagicCastFlag); localPlayer.CastSpell(magicController.GetSpell((int)global.MagicCastFlag)); } //Turn ends after global magic is casted localPlayer.EndTurn(); } } }
/// Signals that a magic token was touched. If all are activated, casts a spell. public void magicActivation(MagicController controller) { magicCounter++; if (magicCounter >= magicCounterMax) { castSpell(); } }
void Start() { players = GameObject.FindGameObjectsWithTag("NetworkedPlayerObjects"); townFoundManager = GameObject.Find("Controller").GetComponent <TownFoundingBonusManager>(); wonderController = GameObject.Find("Controller").GetComponent <WonderController>(); magicController = GameObject.Find("Controller").GetComponent <MagicController>(); roundBonusManager = GameObject.Find("Controller").GetComponent <RoundBonusManager>(); }
// Use this for initialization protected override void Start() { base.Start(); controller = GetComponent <PlayerController>(); magicController = GetComponent <MagicController>(); textInput = GetComponent <TextInput>(); viewCamera = Camera.main; }
void Start() { rb2d = GetComponent <Rigidbody2D>(); playerModel = GetComponent <PlayerModel>(); playerService = GetComponent <PlayerService> (); magicController = firstMagic.GetComponent <MagicController> (); gameStorage = gameObject.AddComponent <GameStorage>(); magicCooldown = 0f; bool test = true; if (test) { playerService.createPlayer(); } }
private void Awake() { magicController = GetComponent <MagicController>(); }
// Use this for initialization void Start() { this.magicController = this.GetComponentInParent <MagicController>(); }
public bool checkMagicHit(MagicController magic, Side side) { if (side == Side.leftSide) { foreach(NinJaController enemy in rightEntities){ if(!enemy.gameObject.activeSelf){ continue; } if(magic.renderer.bounds.Intersects(enemy.renderer.bounds)){ enemy.takeDamageFromMagic(magic); return true; } } } else{ foreach(NinJaController enemy in leftEntities){ if(magic.collider2D.bounds.Intersects(enemy.renderer.bounds)){ enemy.takeDamageFromMagic(magic); return true; } } } return false; }
public void castMagic(MagicController magic, float direction) { //Debug.Log (direction); if (direction < 0) { //right //magic.transform.position = new Vector3(magic.transform.position.x+magic.renderer.bounds.size.x,magic.transform.position // .y,magic.transform.position.z); magic.initPosition(magic.parentController.transform.position); magic.play(Side.rightSide); } else { //magic.transform.localScale = new Vector3(-Mathf.Abs(magic.transform.localScale.x),magic.transform.localScale.y,transform.localScale.z); //magic.transform.position = new Vector3(magic.transform.position.x-magic.renderer.bounds.size.x,magic.transform.position // .y,magic.transform.position.z); magic.initPosition(magic.parentController.transform.position); magic.play(Side.leftSide); //left } }
new void Start() { base.Start(); magicController = card.prefabCard.GetComponent <MagicController>(); }
// Use this for initialization void Start() { this.magicController = this.GetComponentInParent <MagicController>(); this.tipsManager = this.magicController.tipsManager; }
public void takeDamageFromMagic(MagicController other){ float dechealth = (float)other.attack; dechealth *= magicHurtMultiplier; //Debug.Log (other.attack); health -= dechealth; updateHealthBar (); //wild test //WildBuff wb = new WildBuff (); //wb.duration = 3.0f; //ctrl.attachBuffToEntityController (wb, this); // if (health <= 0) { state = State.Dead; //========================== //trigger passive skill foreach (PassiveSkill skl in passiveSkillList) { if(skl.phase == PassiveSkill.Phase.Dead) { skl.activeSkill(null); } } //=========================== } }
//public async static Task<Tuple<double[][], double[][]>> PrepData() //{ // MagicController magicCont = new MagicController(); // int magicCount = await magicCont.GetNumberAsync(); // if (magicCount == 0) // throw new Exception("Data Prep failed"); // List<Tuple<string, string, string, string, int>> types = await magicCont.GetAsync(0, magicCount); // if (types == null) // throw new Exception("Data Prep failed"); // List<double[]> input = new List<double[]>(); // List<double[]> output = new List<double[]>(); // double[] temp; // //prepare outputs // for (int i = 0; i < magicCount; i++) // { // for (int j = 0; j < types[i].Item5; j++) // { // temp = new double[magicCount]; // temp[i] = 1; // output.Add(temp); // } // } // //prepare inputs // List<double[]> range; // for (int i = 0; i < magicCount; i++) // { // range = await magicCont.GetSampleData(types[i].Item1); // if(range == null) // throw new Exception("Data Prep failed"); // input.AddRange(range); // } // return new Tuple<double[][], double[][]>(input.ToArray(), output.ToArray()); //} public async static Task <Tuple <double[][], double[][]> > PrepData() { MagicController magicCont = new MagicController(); int magicCount = await magicCont.GetNumberAsync(); if (magicCount == 0) { throw new Exception("Data Prep failed"); } List <Tuple <string, string, string, string, int> > types = await magicCont.GetAsync(0, magicCount); if (types == null) { throw new Exception("Data Prep failed"); } List <double[]> input = new List <double[]>(); List <double[]> output = new List <double[]>(); int sampleCount = await magicCont.GetSamplesCount(); double[] temp; //prepare outputs for (int i = 0; i < magicCount; i++) { for (int j = 0; j < i; j++) { for (int k = 0; k < types[j].Item5; k++) { temp = new double[1]; temp[0] = 0; output.Add(temp); } } for (int j = 0; j < types[i].Item5; j++) { temp = new double[1]; temp[0] = 1; output.Add(temp); } for (int j = i + 1; j < types.Count; j++) { for (int k = 0; k < types[j].Item5; k++) { temp = new double[1]; temp[0] = 0; output.Add(temp); } } } //prepare inputs List <List <double> > samples = await magicCont.GetSampleData(); List <double> record; List <double> baseline; for (int i = 0; i < magicCount; i++) { baseline = GetBaseline(types[i].Item4); foreach (List <double> sample in samples) { record = new List <double>(); record.AddRange(sample); record.AddRange(baseline); input.Add(record.ToArray()); } } return(new Tuple <double[][], double[][]>(input.ToArray(), output.ToArray())); }