protected override void Awake() { base.Awake(); lifeSystem = GetComponent <LifeSystem>(); combatSystem = GetComponent <CombatSystem>(); characterMotor = GetComponent <CharacterMotor>(); }
// Use this for initialization void Start() { mh = GameObject.FindWithTag("MainHud").GetComponent <MainHud>(); lfs = GameObject.Find("LifeSystem").GetComponent <LifeSystem> (); lfs.Cur_Bricks++; //lfs.levels++; }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); bossContainer = transform.parent.gameObject; bossJambesScript = bossContainer.GetComponent <BossJambes>(); lifeSystemScript = player.GetComponent <LifeSystem>(); }
void Awake() { motor = GetComponent <CharacterMotor>(); playerInput = GetComponent <PlayerMovement>(); lifeSystem = GetComponent <LifeSystem>(); lifeSystem.PlayerDied += OnPlayerDied; }
public void Attack(LifeSystem enemy) { var weaponDamage = equipment.WeaponDamage ?? Unarmed.Damage.ToArray(); foreach (var damage in weaponDamage) { enemy.Damage(damage); } }
public void SetLifeSystem(LifeSystem lifeSystem) { LifeSystem = lifeSystem; slider.maxValue = lifeSystem.MaxHealth; OnHealthChanged(lifeSystem.CurrentHealth); lifeSystem.PlayerDamaged += OnHealthChanged; }
// Start is called before the first frame update void Start() { instance = this; health = 3; heart1.gameObject.SetActive(true); heart2.gameObject.SetActive(true); heart3.gameObject.SetActive(true); gameOver.gameObject.SetActive(false); Update(); }
void Inif() { m_hpController = GameObject.Find("HitPointBar").transform.Find("HpFill"). GetComponent <BarController>(); m_mpController = GameObject.Find("MagicPointBar").transform.Find("HpFill"). GetComponent <BarController>(); m_lifeSystem = GetComponent <LifeSystem>(); m_magicSystem = GetComponent <MagicSystem>(); }
void Start() { //referencia al script de life system playerScript = (LifeSystem)player.GetComponent(typeof(LifeSystem)); //esconde los paneles de pausa. pausePanel.SetActive(false); infoPanel.SetActive(false); updateBars(); }
public CharacterSnapshot(int turn, EquipmentSystem equipment, LifeSystem lifeSystem, Inventory inventory) { Turn = turn; Health = lifeSystem.CurrentHealth; MaxHealth = lifeSystem.MaxHealth; Inventory = inventory.items.CopyList(); Equipment = equipment.EquipmentSlots.CopyArray(); Damage = equipment.WeaponDamage?.Sum(p => p.Value) ?? 0; Armour = equipment.ArmourResistances?.Sum(p => p.Value) ?? 0; }
void Awake() { actionPoints = GetComponent <ActionPointSystem>(); lifeSystem = GetComponent <LifeSystem>(); motor = GetComponent <CharacterMotor>(); vision = GetComponentInChildren <VisionSystem>(); combat = GetComponentInChildren <CombatSystem>(); motor.FinishedMoving += OnFinishedMOving; combat.CombatFinished += OnCombatFinished; }
void Start() { initialArmor = totalArmor; unitsPerArmor = GameManager.singleton.unitsPerLife; ArmorBarMaterial = GameManager.singleton.ArmorBarMaterial; LifeSystem life = GetComponent <LifeSystem>(); ArmorBarHeight = life.lifeBarHeight + .11f; }
public void Unserialize(JSONObject jsonObject) { Levels.Clear(); var levelInfo = jsonObject.GetField("LevelInfo"); foreach (var o in levelInfo.list) { Levels.Add(LevelInfo.Unserialize(o)); } Lifes = LifeSystem.Unserialize(jsonObject.GetField("Lifes")); }
void Start() { //controller y animator controller = GetComponent <CharacterController>(); anim = gameObject.GetComponentInChildren <Animator>(); playerScript = (LifeSystem)this.GetComponent(typeof(LifeSystem)); playerAudioSource = GetComponent <AudioSource>(); speed = playerScript.currentSpeed; }
public void Unserialize(JSONObject jsonObject) { Levels.Clear(); var levelInfo = jsonObject.GetField("LevelInfo"); foreach (var o in levelInfo.list) { Levels.Add(LevelInfo.Unserialize(o)); } Levels.Sort(LevelInfo.Comparer); Lifes = LifeSystem.Unserialize(jsonObject.GetField("Lifes")); }
void Awake() { equipment = GetComponent <EquipmentSystem>(); inventory = GetComponent <Inventory>(); lifeSystem = GetComponent <LifeSystem>(); rewindUI = FindObjectOfType <RewindUI>(); turnSystem = FindObjectOfType <TurnSystem>(); turnSystem.PlayerTurnStarted += TakeSnapshot; turnSystem.PlayerTurnStarted += ReduceCooldown; currentCooldown = 4; }
void Start() { Currentcheckpoint = PlayerPrefs.GetInt("CheckPoint"); player = GameObject.FindGameObjectWithTag("Player"); player.GetComponent <LifeSystem>().ActiveCamera = camCinemachineMain; camAudioSource = cam.GetComponent <AudioSource>(); lifeSystemScript = player.GetComponent <LifeSystem>(); animatorNamesScript = player.GetComponent <AnimatorNames>(); smashScript = player.GetComponent <Smash>(); powerScreenAnimator = powerScreen.GetComponent <Animator>(); inputManager = GameObject.Find("InputManager"); inputManagerScript = inputManager.GetComponent <InputManager>(); camCinemachineMainVirtualCamera = camCinemachineMain.GetComponent <CinemachineVirtualCamera>(); camCinemachineLock1VirtualCamera = camCinemachineLock1.GetComponent <CinemachineVirtualCamera>(); camCinemachineLock2VirtualCamera = camCinemachineLock2.GetComponent <CinemachineVirtualCamera>(); endGameScript = GetComponent <EndGame>(); backgroundParallax = background.GetComponent <Parallax>(); treesParallax = trees.GetComponent <Parallax>(); mixer.SetFloat("MasterVolume", PlayerPrefs.GetFloat("Volume") / volumeScale); if (PlayerPrefs.GetInt("CheckPoint") == 0) { player.transform.position = cp0.position; } else if (PlayerPrefs.GetInt("CheckPoint") == 1) { player.transform.position = cp1.position; UpgradePlayer(2); wallB11.SetActive(true); BossArmsDead = true; Destroy(boss1); camCinemachineMainVirtualCamera.Priority = cameraHighPrority; camCinemachineLock1VirtualCamera.Priority = cameraLowPriority; } else if (PlayerPrefs.GetInt("CheckPoint") == 2) { UpgradePlayer(3); player.transform.position = cp2.position; wallB21.SetActive(true); BossArmsDead = true; BossLegsDead = true; endGameScript.enabled = true; Destroy(boss1); Destroy(boss2); camCinemachineMainVirtualCamera.Priority = cameraHighPrority; camCinemachineLock1VirtualCamera.Priority = cameraLowPriority; camCinemachineLock2VirtualCamera.Priority = cameraLowPriority; EnableLegs(); } }
// Use this for initialization void Start() { // text = GetComponent<Text> (); healthBar = GetComponent <Slider> (); playerHealth = PlayerPrefs.GetInt("PlayerCurrentHealth"); //to retain the player health between all levels lifeSystem = FindObjectOfType <LifeSystem> (); levelManager = FindObjectOfType <LevelManager> (); isDead = false; }
/// <summary> /// openfire function /// </summary> public void OpenfireEvent() { RaycastHit hitInfo; bool ifHitSomething = Physics.SphereCast(transform.position, m_BoxCollider.bounds.size.x, this.transform.forward, out hitInfo, this.attackRange); //if the ai tank in player attack range,we reduce the life value of ai tank if (ifHitSomething == true && hitInfo.transform.CompareTag("AITank")) { LifeSystem lifeSystem = hitInfo.transform.GetComponent <LifeSystem>(); lifeSystem.ChangeCurrentLifeValue(-10.0f); } }
// public float velocity = 1; // private Vector3 direction; // Use this for initialization void Start() { // Initial Velocity //GetComponent<Rigidbody2D>().velocity = Vector2.right * speed; lfs = GameObject.Find("LifeSystem").GetComponent <LifeSystem> (); isDead = false; //rb2d = GetComponent<Rigidbody2D> (); //mh = GameObject.Find ("MainHud").GetComponent<MainHud> (); /*float randomDirection = UnityEngine.Random.Range (-1f, 1f); * int x = (int)Mathf.Sign (randomDirection); * direction = new Vector3 (x, 1, 0); * direction.Normalize (); */ }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); animatorComponent = GetComponent <Animator>(); rightDamageZoneScript = rightDamageZone.GetComponent <DamageZone>(); leftDamageZoneScript = leftDamageZone.GetComponent <DamageZone>(); lifeSystemScript = player.GetComponent <LifeSystem>(); playerRigidbody = player.GetComponent <Rigidbody2D>(); playerMovementScript = player.GetComponent <PlayerMovement>(); dashZoneScript = dashZone.GetComponent <DashZone>(); popup.SetActive(true); StartCoroutine("States", "Start"); }
//Check if the player as collided with the object private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { //Get his life system script lifeSystemScript = collision.GetComponent <LifeSystem>(); //Check if he is not full life if (lifeSystemScript.Life < maxLife) { //Rise his life lifeSystemScript.RiseLife(); } //Instantiate the Poof Prefab and destroy itself Instantiate(poof, transform.position, Quaternion.identity); Destroy(gameObject.transform.parent.gameObject); } }
private void Awake() { entities = new List <Entity>(); newEntities = new Queue <Entity>(); expiredEntities = new Queue <Entity>(); entitySystem = new EntitySystem(this); inputSystem = new InputSystem(this); moveSystem = new MoveSystem(this); lifeSystem = new LifeSystem(this); controllerSystem = new ControllerSystem(this); gunSystem = new GunSystem(this); bulletSystem = new BulletSystem(this); buffSystem = new BuffSystem(this); effectSystem = new EffectSystem(this); laserSystem = new LaserSystem(this); aiSystem = new AISystem(this); levelSystem = new LevelSystem(this); }
private void Awake() { if (Instance != null && Instance != this) { Debug.LogWarning("Instancia de box manager ya existe, borrando esta...", gameObject); Destroy(gameObject); return; } Instance = this; if (player == null || box == null) { Debug.LogWarning("Player o Box nulos!"); return; } rayBox = box.GetComponent <RayBox>(); container = box.GetComponent <BoxAtomContainer>(); life = player.GetComponent <LifeSystem>(); }
private void Start() { //Assign components to variables rigid = GetComponent <Rigidbody2D>(); player = GameObject.FindGameObjectWithTag("Player").transform; playerDetectorScript = playerDetector.GetComponent <PlayerDetector>(); rightSideDetectorScript = rightDetector.GetComponent <EnemySideDetector>(); leftSideDetectorScript = leftDetector.GetComponent <EnemySideDetector>(); dashDampScript = player.GetComponent <DashDamp>(); inhaleScript = player.GetComponent <Inhale>(); playerRigidBody = player.GetComponent <Rigidbody2D>(); enemyHeadColliderScript = GetComponentInChildren <EnemyHeadCollider>(); playerLifeSystem = player.GetComponent <LifeSystem>(); //Get the Scale of the Object; objectScale = transform.localScale; //Invoke the Jump method InvokeRepeating("Jump", 0, jumpTimeStep); }
private void Start() { switch (gameObject.tag) { case "Player": playerNumber = 0; break; case "Player2": playerNumber = 1; break; default: playerNumber = -1; break; } maxHealth = health; ls = FindObjectOfType <LifeSystem>(); rend = GetComponent <Renderer>(); }
void herir(Transform target) { if (target.transform.tag == tagDamage) { Debug.Log(target.transform.tag); ds = target.transform.GetComponent <LifeSystem>(); if (ds) { ds.hurt(damage); if (force > 0) { var direction = target.position - transform.position; ds.rigidbody2D.AddForce(direction.normalized * force / 10, ForceMode2D.Impulse); } } if (destroyOnTrigger) { Destroy(gameObject); } } }
private IEnumerator Retaliate(LifeSystem targetLifeSystem, CombatSystem targetCombatSystem) { yield return(new WaitForSeconds(2)); if (!lifeSystem.IsDead) { transform.LookAt(targetLifeSystem.transform, Vector3.up); characterMotor.OnAttack(); combatSystem.Attack(targetLifeSystem); targetLifeSystem.GetComponent <CharacterMotor>().OnHit(); yield return(new WaitForSeconds(2)); } if (!targetLifeSystem.IsDead) { var targetDestination = GridHelper.GetNearestTile(transform.position + (targetLifeSystem.transform.position - transform.position).normalized * 5); targetLifeSystem.GetComponent <CharacterMotor>().setDestination(targetDestination); } targetCombatSystem.OnConbatFinished(); }
protected override void Awake() { base.Awake(); this.NavMeshAgent = GetComponent <NavMeshAgent>(); this.Animator = GetComponent <Animator>(); this.TrackRender = aiTankTrack.GetComponent <Renderer>(); this.MainBodyRender = aiTankMainBody.GetComponent <Renderer>(); this.NozzleRender = aiTankNozzle.GetComponent <Renderer>(); this.ParticleSystemArray = explosionEffect.GetComponentsInChildren <ParticleSystem>(); //Initialize FSM process FSMInitialize(); m_FSMUpdateTimer = Time.time + updateInveral; LifeSystem = GetComponent <LifeSystem>(); }
public override void OnUpdate() { //AI originalRotation Quaternion originalRotation = this.m_AIController.transform.rotation; //AI targetRotation Quaternion targetRotation = Quaternion.LookRotation(m_AttackTarget.transform.position - this.m_AIController.transform.position); //turn to the attack target this.m_AIController.transform.rotation = Quaternion.Slerp(originalRotation, targetRotation, Time.deltaTime * m_TurrentRotateSpeed); RaycastHit hitInfo; //detect if the gun of AI has aimed the attack target bool ifHitSomething = Physics.SphereCast(this.m_AIController.transform.position, m_NavMeshAgent.radius, this.m_AIController.transform.forward, out hitInfo, this.m_AIController.sightRange); //if AI has aimed the attack target if (ifHitSomething == true && hitInfo.transform.CompareTag("PlayerTank")) { if (Time.time > m_AttackIntervalTimer) { m_AttackIntervalTimer = Time.time + m_AttackInterval; //play the openfire animation m_Animator.SetTrigger("openfire"); //if attack target has the life system,reduce it life value LifeSystem lifeSystem = hitInfo.transform.GetComponent <LifeSystem>(); if (lifeSystem != null) { lifeSystem.ChangeCurrentLifeValue(-10.0f); } } } }
void Start() { lifeSystem = FindObjectOfType <LifeSystem> (); }