//Gravity Invert (Invertir) public CommandParser.enchantmentResponse gravityInvert(EnchantableObjTags.Tags tag) { if (PlayerGrimoire.GetInstance()._gravityBreak) { _listEnchantableObj = _levelManager.findEnchantableObj(tag); if (_listEnchantableObj.Count > 0) { foreach (GameObject aux in _listEnchantableObj) { Debug.Log(aux.name); if (aux.GetComponent <EnchantableObjProperties>().AllowChangeGravite) { aux.GetComponent <Rigidbody2D>().gravityScale *= -1; aux.GetComponent <EnchantableObj>().saveCurretGravityScale(); Instantiate(_objMagicCloud, aux.transform); // la nube magica } } _audioSource.clip = _gravityBreak; _audioSource.Play(); return(CommandParser.enchantmentResponse.SUCCESS); } else { return(CommandParser.enchantmentResponse.FAIL); } } else { return(CommandParser.enchantmentResponse.FAIL); } }
public void tutorialCommadExe(PlayerGrimoire.commands commands, EnchantableObjTags.Tags tag = EnchantableObjTags.Tags.NONE) { if (_instructionIsEnchantment.Count > 0) { if (!_instructionIsEnchantment[0]) { if (commands == _commands[0]) { //sacar lo que esta de primeras _commands.RemoveAt(0); _instructionIsEnchantment.RemoveAt(0); // coloca la siguiete linea de dialogo _dialogManager.DisplayNextSentence(); switch (commands) { case PlayerGrimoire.commands.JUMP: _ocelotMovements.jump(); break; case PlayerGrimoire.commands.RUN: _ocelotMovements.run(); break; case PlayerGrimoire.commands.WALK: _ocelotMovements.move(); break; case PlayerGrimoire.commands.STAY_PUT: _ocelotMovements.idle(); break; case PlayerGrimoire.commands.WALK_FORWARD: _ocelotMovements.walkForward(); break; case PlayerGrimoire.commands.WALK_BACKWARDS: _ocelotMovements.walkBackwards(); break; case PlayerGrimoire.commands.GRAB: _ocelotMovements.grab(); break; } if (_instructionIsEnchantment.Count == 0) { Invoke("finishTutorial", 3); } } } } }
//TODO: Crear funcion pra buscar objeto encantable por tag especial public List <GameObject> findEnchantableObj(EnchantableObjTags.Tags tag) { List <GameObject> enchantableObjList = new List <GameObject>(); foreach (GameObject enchantableObj in _enchantmentsObjs) { if (enchantableObj.GetComponent <EnchantableObj>().EnchantableObjTag == tag) { enchantableObjList.Add(enchantableObj); } } return(enchantableObjList); }
public void tutorialEnchantmentExe(PlayerGrimoire.enchantment enchantment, EnchantableObjTags.Tags tag) { if (_instructionIsEnchantment.Count > 0) { if (_instructionIsEnchantment[0]) { if (enchantment == _enchantments[0] && _tag == tag) { //sacar lo que esta de primeras _enchantments.RemoveAt(0); _instructionIsEnchantment.RemoveAt(0); // coloca la siguiete linea de dialogo _dialogManager.DisplayNextSentence(); switch (enchantment) { case PlayerGrimoire.enchantment.BIGGER_IS_BETTER: _enchantmentsExe.makeBigger(tag); break; case PlayerGrimoire.enchantment.GRAVITY_BREAKS: _enchantmentsExe.gravityInvert(tag); break; case PlayerGrimoire.enchantment.IGNITE_SPARK: _enchantmentsExe.spark(tag); break; case PlayerGrimoire.enchantment.SMALLER_IS_CUTE: _enchantmentsExe.makeSmaller(tag); break; case PlayerGrimoire.enchantment.SHOW_ME_MORE: _enchantmentsExe.showTags(); break; } if (_instructionIsEnchantment.Count == 0) { Invoke("finishTutorial", 3); } } } } else { // termina el tutorial Invoke("finishTutorial", 3); } }
//Spark public CommandParser.enchantmentResponse spark(EnchantableObjTags.Tags tag) { if (PlayerGrimoire.GetInstance()._igniteSpark) { _listEnchantableObj = _levelManager.findEnchantableObj(tag); if (_listEnchantableObj.Count > 0) { foreach (GameObject aux in _listEnchantableObj) { Instantiate(_objSpark, aux.transform); if (aux.GetComponent <EnchantableObjProperties>().AllowIgnite) { aux.GetComponent <EnchantableObj>().turnOn(); aux.GetComponent <EnchantableObjProperties>().Onfire = true; } else if (aux.GetComponent <EnchantableObjProperties>().DestroyWhiteFire) { aux.AddComponent <SelfDestroy>().Time = 1; Instantiate(ObjFire, aux.transform); } else if (aux.GetComponent <EnchantableObjProperties>().OnBurn) { Instantiate(ObjFire, aux.transform).GetComponent <SelfDestroy>().enabled = false; aux.GetComponent <EnchantableObjProperties>().Onfire = true; } } _audioSource.clip = _ignite; _audioSource.Play(); return(CommandParser.enchantmentResponse.SUCCESS); } else { return(CommandParser.enchantmentResponse.FAIL); } } else { return(CommandParser.enchantmentResponse.FAIL); } }
//Make Smaller (x1/2) public CommandParser.enchantmentResponse makeSmaller(EnchantableObjTags.Tags tag) { if (PlayerGrimoire.GetInstance()._smallIscute) { _listEnchantableObj = _levelManager.findEnchantableObj(tag); if (_listEnchantableObj.Count > 0) { foreach (GameObject aux in _listEnchantableObj) { // comprueba si a ese objeto ya se le habia modificado el tamaño o si esta disponible para hacerlo pequeño if (aux.GetComponent <EnchantableObjProperties>().AllowMakeSmaller || !aux.GetComponent <EnchantableObjProperties>().AllowMakeBigger) { aux.transform.localScale = new Vector3(aux.transform.localScale.x / 2, aux.transform.localScale.y / 2, aux.transform.localScale.z); Instantiate(_objMagicCloud, aux.transform); // si el objeto era grande deja que lo vuelva a hacer grande o que lo siga pequeño if (!aux.GetComponent <EnchantableObjProperties>().AllowMakeBigger) { aux.GetComponent <EnchantableObjProperties>().AllowMakeBigger = true; } // si el objeto estaba normal no deja que lo siga agrandando else { aux.GetComponent <EnchantableObjProperties>().AllowMakeSmaller = false; } } } _audioSource.clip = _magic; _audioSource.Play(); return(CommandParser.enchantmentResponse.SUCCESS); } else { return(CommandParser.enchantmentResponse.FAIL); } } else { return(CommandParser.enchantmentResponse.FAIL); } }