// Use this for initialization void Start() { playerStaminaMan = FindObjectOfType <PlayerStaminaManager>(); thePlayer = FindObjectOfType <PlayerController>(); sfxMan = FindObjectOfType <SFXManager>(); shield = FindObjectOfType <ShieldBlock>(); thePS = FindObjectOfType <PlayerStats>(); enemy = FindObjectOfType <EnemyTestScript>(); playerHealth = FindObjectOfType <PlayerHealthManager>(); hurtEnemy = FindObjectOfType <HurtEnemy>(); enemyHealth = FindObjectOfType <EnemyHealthManager>(); playerEngagement = FindObjectOfType <EngagedWithPlayer>(); // enemyStaminaMan = FindObjectOfType<EnemyStaminaManager>(); deathStrike = false; showBlood = false; playerStaminaDrain = false; }
public void Setup() //performs the same actions as MonoBehaviour's Start() function { playerHealthManager = FindObjectOfType <PlayerHealthManager>(); hurtEnemy = FindObjectOfType <HurtEnemy>(); maxHealth = playerHealthManager.GetMaxHealth(); }
// Use this for initialization void Start() { thePlayerStats = FindObjectOfType <PlayerStats> (); hurtEn = FindObjectOfType <HurtEnemy> (); theEHM = FindObjectOfType <EnemyHealthManager> (); theWeapon = FindObjectOfType <WeaponManager> (); }
// Use this for initialization void Start() { game = FindObjectOfType <GameController>(); story = FindObjectOfType <StoryScript>(); HurtE = FindObjectOfType <HurtEnemy>(); exp = FindObjectOfType <Experience>(); looponce = true; Tijd = 20; }
//private static weakSwordCheck = false; // Use this for initialization void Start() { activateWeapon = FindObjectOfType <WeaponManager> (); theEHM = FindObjectOfType <EnemyHealthManager> (); hurten = FindObjectOfType <HurtEnemy> (); hintTrigger = FindObjectOfType <HintTrigger> (); sfxMan = FindObjectOfType <SFXManager> (); anim = FindObjectOfType <PlayerController>().GetComponent <Animator> (); //DontDestroyOnLoad (transform.gameObject); //gameObject.SetActive (true); }
// Use this for initialization void Start() { hurtPlayer = FindObjectOfType <HurtPlayerUpdated>(); playerStaminaMan = FindObjectOfType <PlayerStaminaManager>(); thePlayer = FindObjectOfType <PlayerController>(); sfxMan = FindObjectOfType <SFXManager>(); shield = FindObjectOfType <ShieldBlock>(); thePS = FindObjectOfType <PlayerStats>(); enemyGameObject = this.gameObject.transform.parent.gameObject; enemy = enemyGameObject.GetComponent <EnemyTestScript>(); rangedEnemy = enemyGameObject.GetComponent <BasicRangedEnemy>(); enemyMaster = enemyGameObject.GetComponent <EnemyMasterScript>(); enemyTransform = enemyGameObject.transform; rangedAttack = enemyGameObject.GetComponent <EnemyRangedAttack>(); playerHealth = FindObjectOfType <PlayerHealthManager>(); hurtEnemy = FindObjectOfType <HurtEnemy>(); playerShield = FindObjectOfType <ShieldBlock>(); hitPoint = GameObject.Find("Player").transform; bloodCounter = 10; deathStrike = false; thePlayerDeathStrike = false; playerStaminaDrain = false; faceOff = false; check = 0; beforeRecov = true; enemyAttackCounter = 1f; enemyDamagePossible = false; preAttack = false; recovAttack = false; preAttackCounter = 0.6f; recovAttackCounter = 0.3f; enemyAttackCounter = 0.06f; freezeFrame = 1f; }
// Use this for initialization void Start() { thePlayer = FindObjectOfType <PlayerController> (); theMM = FindObjectOfType <MoneyManager> (); addArrows = FindObjectOfType <Arrows> (); activateWeapon = FindObjectOfType <WeaponManager> (); hurtEn = FindObjectOfType <HurtEnemy> (); theEHM = FindObjectOfType <EnemyHealthManager> (); thePHM = FindObjectOfType <PlayerHealthManager> (); dBox.SetActive(false); dialogActive = false; dBox2.SetActive(false); }
// Use this for initialization void Start() { if (!UIExists) { UIExists = true; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } thePS = GetComponent <PlayerStats> (); theWeapon = FindObjectOfType <WeaponManager> (); amountOfArrows = FindObjectOfType <Arrows> (); theEHM = FindObjectOfType <EnemyHealthManager> (); theHE = FindObjectOfType <HurtEnemy> (); }
// Use this for initialization void Start() { // dodgeDistanceFloat = 3; enemyD = FindObjectOfType <EnemyDialogue>(); dummyGameObject = GameObject.Find("Dummy Object"); //rayCastHitDodge.size; rayCastDodgeArray = new int[100]; playerObject = GameObject.Find("Player"); playerTransform = playerObject.transform; layerMaskPlayerInt = 1 << 9; layerMaskPlayer = ~layerMaskPlayerInt; layerMaskBoundsInt = 1 << 10; layerMaskBounds = ~layerMaskBoundsInt; layerMaskEnemyInt = 1 << 11; layerMaskEnemy = ~layerMaskEnemyInt; rayDodgeDistance = 4; playerStats = FindObjectOfType <PlayerStats>(); playerShield = FindObjectOfType <ShieldBlock>(); sfxMan = FindObjectOfType <SFXManager>(); theDM = FindObjectOfType <DialogueManager>(); staminaMan = GetComponent <PlayerStaminaManager>(); enemy = FindObjectOfType <EnemyTestScript>(); playerHealth = FindObjectOfType <PlayerHealthManager>(); hurtPlayer = FindObjectOfType <HurtPlayerUpdated>(); hurtEnemy = FindObjectOfType <HurtEnemy>(); globalData = FindObjectOfType <GlobalDataScript>(); playerBoundBoxObject = GameObject.Find("Bounds"); enemyTargetObject = this.gameObject; dmObject = GameObject.Find("Dialogue Manager"); theDM = dmObject.GetComponent <DialogueManager>(); terrainManager = FindObjectOfType <TerrainManager>(); damagePossible = false; attackPossible = true; dashPossible = true; anim = GetComponent <Animator>(); myRigidbody = GetComponent <Rigidbody2D>(); if (!playerExists) { playerExists = true; //DontDestroyOnLoad(transform.gameObject); } else { //Destroy(gameObject); } canMove = true; lastMove = new Vector2(globalData.globalPlayerLastMoveX, globalData.globalPlayerLastMoveY); currentEnemyExists = true; if (boundBox == null) { //boundBox = FindObjectOfType<BoundsScript>().GetComponent<BoxCollider2D>(); boundBox = playerBoundBoxObject.GetComponent <BoxCollider2D>(); minBounds = boundBox.bounds.min; maxBounds = boundBox.bounds.max; } minBounds = boundBox.bounds.min; maxBounds = boundBox.bounds.max; deathStrike = false; playerOldHealth = playerNewHealth; strikeBlock = false; strikeBlockCounter = 1f; noDamageIsTaken = true; preAttack = false; recovAttack = false; preAttackCounter = 0.2f; recovAttackCounter = 0.3f; attackTimeCounter = 10; attackingCounterNew = 0.06f; specialMove = false; wasMoving = false; wasSprint = false; sprintTimer = 0.2f; sprintPossible = false; // if (globalData.globalPlayerLockOn == 1) // { // lockOn = false; // } // else // { // lockOn = false; // } lockOn = false; newListBool = true; switchEnemyBool = true; equipmentBuffManagerScript = FindObjectOfType <EquipmentBuffManager>(); lockOnImage = GameObject.Find("lockOnImage"); lockOnImage.SetActive(false); }
// Start is called before the first frame update void Start() { enemyHp = GetComponent <HurtEnemy>(); }
// Update is called once per frame void Update() { bool isMoving = Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.W); if (isMoving && Input.GetKey(KeyCode.A) && Input.GetButton("ShootRight")) { anim.SetBool("ShootRight", true); } else { anim.SetBool("ShootRight", false); } if (isMoving && Input.GetKey(KeyCode.D) && Input.GetButton("ShootLeft")) { anim.SetBool("ShootLeft", true); } else { anim.SetBool("ShootLeft", false); } if (isMoving && Input.GetKey(KeyCode.W) && Input.GetButton("ShootDown")) { anim.SetBool("ShootDown", true); } else { anim.SetBool("ShootDown", false); } if (isMoving && Input.GetKey(KeyCode.S) && Input.GetButton("ShootUp")) { anim.SetBool("ShootUp", true); } else { anim.SetBool("ShootUp", false); } if (isMoving && Input.GetKey(KeyCode.A) && Input.GetButton("ShootDown")) { anim.SetBool("ShootLeftFaceDown", true); } else { anim.SetBool("ShootLeftFaceDown", false); } if (isMoving && Input.GetKey(KeyCode.A) && Input.GetButton("ShootUp")) { anim.SetBool("ShootLeftFaceUp", true); } else { anim.SetBool("ShootLeftFaceUp", false); } if (isMoving && Input.GetKey(KeyCode.D) && Input.GetButton("ShootDown")) { anim.SetBool("ShootRightFaceDown", true); } else { anim.SetBool("ShootRightFaceDown", false); } if (isMoving && Input.GetKey(KeyCode.D) && Input.GetButton("ShootUp")) { anim.SetBool("ShootRightFaceUp", true); } else { anim.SetBool("ShootRightFaceUp", false); } if (isMoving && Input.GetKey(KeyCode.W) && Input.GetButton("ShootRight")) { anim.SetBool("ShootUpFaceRight", true); } else { anim.SetBool("ShootUpFaceRight", false); } if (isMoving && Input.GetKey(KeyCode.W) && Input.GetButton("ShootLeft")) { anim.SetBool("ShootUpFaceLeft", true); } else { anim.SetBool("ShootUpFaceLeft", false); } if (isMoving && Input.GetKey(KeyCode.S) && Input.GetButton("ShootRight")) { anim.SetBool("ShootDownFaceRight", true); } else { anim.SetBool("ShootDownFaceRight", false); } if (isMoving && Input.GetKey(KeyCode.S) && Input.GetButton("ShootLeft")) { anim.SetBool("ShootDownFaceLeft", true); } else { anim.SetBool("ShootDownFaceLeft", false); } if ((!isMoving && Input.GetButton("ShootRight"))) { anim.SetBool("ShootIdleRight", true); } else { anim.SetBool("ShootIdleRight", false); } if ((!isMoving && Input.GetButton("ShootLeft"))) { anim.SetBool("ShootIdleLeft", true); } else { anim.SetBool("ShootIdleLeft", false); } if ((!isMoving && Input.GetButton("ShootUp"))) { anim.SetBool("ShootIdleUp", true); } else { anim.SetBool("ShootIdleUp", false); } if ((!isMoving && Input.GetButton("ShootDown"))) { anim.SetBool("ShootIdleDown", true); } else { anim.SetBool("ShootIdleDown", false); } timeBetweenShots++; SHOOTING_DIRECTION dir = Input.GetButton("ShootRight") ? SHOOTING_DIRECTION.RIGHT : Input.GetButton("ShootLeft") ? SHOOTING_DIRECTION.LEFT : Input.GetButton("ShootUp") ? SHOOTING_DIRECTION.UP : Input.GetButton("ShootDown") ? SHOOTING_DIRECTION.DOWN : SHOOTING_DIRECTION.NONE; if (timeBetweenShots > ShotDelay) { if (dir != SHOOTING_DIRECTION.NONE) { GameObject P = (GameObject)Instantiate(projectilePrefab, transform.position, Quaternion.identity); HurtEnemy pScript = P.GetComponent <HurtEnemy>(); pScript.damageToGive = pScript.damageToGive + currentDamage; Projectile p = new Projectile(P, dir); Projectiles.Add(p); timeBetweenShots = 0; } } List <Projectile> deleteList = new List <Projectile>(); foreach (Projectile goBullet in Projectiles) { if (goBullet.IsBulletDead()) { //Agregar a projectiles a borrar deleteList.Add(goBullet); } else { goBullet.Update(Time.deltaTime); } } //Borrar todos los projectiles que corresponda foreach (Projectile delete in deleteList) { Projectiles.Remove(delete); //DestroyObject(delete); } }
// Use this for initialization void Start() { MaxHp = FindObjectOfType <PlayerHealthManager> (); Attack = FindObjectOfType <HurtEnemy> (); }