/// <summary> /// Crée un objet MainCharacter et renvoie son script /// </summary> /// <param name="name"></param> /// <param name="health"></param> /// <param name="energyAmount"></param> /// <returns>Script du MainCharacter créé</returns> public static MainCharacterScript CreateCharacter(string name, int health, int energyAmount) { MainCharacterScript mainCharacter = Instantiate(instance.mainCharacterPreFab, Vector3.zero, Quaternion.identity).GetComponent <MainCharacterScript>(); mainCharacter.Initialize(name, health, energyAmount); return(mainCharacter); }
// Start is called before the first frame update void Start() { rigidbody2D = GetComponent <Rigidbody2D>(); player = player.GetComponent <MainCharacterScript>(); target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); animator = GetComponent <Animator>(); }
public void SearchDataFromJsonRessources() { Debug.Log(JsonContent); JObject o = JObject.Parse(JsonContent); MainCharacterScript character = o.SelectToken("Assets/Data/character.john").Value <MainCharacterScript>(); Debug.Log(character.Name); }
void OnCollisionEnter2D(Collision2D other) { MainCharacterScript player = other.gameObject.GetComponent <MainCharacterScript>(); if (player != null) { player.changeHealth(-1); } }
// Use this for initialization void Start() { GameObject mainCharacter = GameObject.FindGameObjectWithTag("MainCharacterShop"); mainCharacterScript = (MainCharacterScript)mainCharacter.GetComponent(typeof(MainCharacterScript)); GameObject textHolder = GameObject.FindGameObjectWithTag("TextHolderShop"); textScript = (TextScript)textHolder.GetComponent(typeof(TextScript)); }
// Start is called before the first frame update void OnTriggerEnter2D(Collider2D other) { MainCharacterScript controller = other.GetComponent <MainCharacterScript>(); if (controller != null) { Debug.Log("Score: " + score.getScore()); controller.updateScore(1000); //controller.changeHealth(1); Destroy(gameObject); } }
void Update() { GameObject gameObject = GameObject.Find("Main Character"); MainCharacterScript mainCharacterScript = gameObject.GetComponent <MainCharacterScript>(); playerLife.text = mainCharacterScript.life.ToString(); playerBullet.text = mainCharacterScript.bullet.ToString(); playerBullet2.text = mainCharacterScript.bullet2.ToString(); }
void OnTriggerEnter2D(Collider2D other) { MainCharacterScript controller = other.GetComponent <MainCharacterScript>(); if (controller != null) { if (counter == 0) { this.gameObject.GetComponent <SpriteRenderer>().sprite = openChest; Instantiate(item, new Vector3(this.transform.position.x, this.transform.position.y - 1, this.transform.position.z), this.transform.rotation); counter++; } // Destroy(gameObject); } }
// Use this for initialization void Start() { instance = this; rigidbody2D = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); isFacingRight = true; sliding = false; animator.SetBool("Sliding", sliding); slidetime = maxSlideTime; slideCoolDownTime = slideCoolDown; attackMelee = false; animator.SetBool("Attack_Melee", attackMelee); attackMeleeCoolDownTime = attackMeleeCoolDown; shield = false; animator.SetBool("Shield", shield); shieldCoolDownTime = shieldCoolDown; crouch = false; animator.SetBool("Crouch", crouch); shoot = false; gun1 = false; hasgun1 = false; animator.SetBool("Gun1", gun1); shoot2 = false; gun2 = false; hasgun2 = false; animator.SetBool("Gun2", gun2); die = false; animator.SetBool("Die", die); knockback = false; knockbackCoolDownTime = 0.5f; damageSystem = GetComponent <DamageSystem>(); damageSystem.DisableDamage(); healthSystem = GetComponent <HealthSystem>(); }
// Use this for initialization void Start() { battlePhase = BattleScenePhases._Blank.ToString(); playerInput = 0; turn = 0; playerChoiceData[0] = playerChoiceData[1] = playerChoiceData[2] = 0; Hidden = E_Choice1[0].renderer.material; battleMenu = BattleMenuManager.GetComponent <BattleMenuScript>(); playerClone = Player.GetComponent <MainCharacterScript>(); enemyClone = Enemy[SelectedEnemyID].GetComponent <WeakEnemySampleScript>(); enemy1 = Enemy[0].GetComponent <WeakEnemySampleScript>(); enemy2 = Enemy[1].GetComponent <WeakEnemySampleScript>(); enemy3 = Enemy[2].GetComponent <WeakEnemySampleScript>(); }
// Use this for initialization void Start() { mainCharacterScript = player.GetComponent <MainCharacterScript>(); }
public static void init(MainCharacterScript mainCharacter) { mainCharScript = mainCharacter; motionBlur = GameObject.Find("CenterEyeAnchor").GetComponentInChildren<UnityStandardAssets.ImageEffects.MotionBlur>(); currentInsanityLevel = 0; }
public void Start() { mainChar = GameObject.Find("MainCharacter").GetComponentInChildren<MainCharacterScript>(); taserSystem = GameObject.Find("TaserSystem").GetComponentInChildren<ParticleSystem>(); electricSound = GameObject.Find("ElectricSound").GetComponentInChildren<AudioSource>(); }
// Use this for initialization void Start() { SanitySystem.Reset(); mainChar = GameObject.Find("MainCharacter").GetComponentInChildren<MainCharacterScript>(); }