protected override void OnInitialize() { base.OnInitialize(); EquipmentComponent = Parent.GetComponent <EquipmentComponent>(); AttributesComponent = this.GetDependency <AttributesComponent>(); MovementComponent = this.GetDependency <MovementComponent>(); SpriteComponent = this.GetDependency <SpriteComponent>(); PhysicsSystem = Parent.Scene.GetSystem <PhysicsSystem>(); PhysicsComponent = Parent.GetComponent <PhysicsComponent>(); CombatPropertiesComponent = this.GetDependency <CombatPropertiesComponent>(); _ShieldAnimation = new ShieldAnimation(this.Parent, "Sprites/Misc/Shield_Yellow2"); }
// private PlayerController polarityModifierSwitch; // << TO DO to be implemented with player's ability to use enemy fire against them // Start is called before the first frame update void Start() { // Initialize references GameObject gameManagerObject = GameObject.FindWithTag("GameManager"); gameManager = gameManagerObject.GetComponent <GameManager>(); GameObject soundManagerObject = GameObject.FindWithTag("SoundManager"); soundManager = soundManagerObject.GetComponent <SoundManager>(); enemyDamage = GetComponent <DetectCollisions>(); lifeBar = FindObjectOfType <LifeBar>(); playerController = FindObjectOfType <PlayerController>(); speedBar = FindObjectOfType <SpeedBar>(); activeScene = SceneManager.GetActiveScene(); shieldCanvas = FindObjectOfType <PlayerShieldCanvas>(); shieldAnimation = FindObjectOfType <ShieldAnimation>(); // Initialize Life-Hit points and check for tutorial mode playerCurrentHitPoints = playerMaxHitPoints; lifeBar.SetMaxLife(playerCurrentHitPoints); //TutorialModeCheck(); StartCoroutine(RegenerateHP()); // polarityModifierSwitch = FindObjectOfType<PlayerController>(); // << TO DO to be implemented with player's ability to use return enemy fire }
// Start is called before the first frame update void Start() { _myBody = GetComponent <Rigidbody2D>(); _myAnimations = GetComponent <PlayerAnimations>(); _transform = GetComponent <Transform>(); _weapon = attack.GetComponent <BoxCollider2D>(); _movement = new Vector3(moveSpeed, 0, 0); _isSliding = false; _startTime = 0; _dead = false; baseMoveSpeed = moveSpeed; _weapon.enabled = false; _myShieldAnimation = GetComponentInChildren <ShieldAnimation>(); _canDash = true; SaveData.WriteValueInt("PlayerInGame", SaveData.ReadValueInt("PlayerInGameMemorie")); if (SaveData.ReadValueInt("PlayerInGameMemorie") == 1) { SaveData.AddValueInt("SoloGame", 1); } else { SaveData.AddValueInt("MultiGame", 1); } shield = false; if (SaveData.ReadValueInt("Shield") > 0) { _myShieldAnimation.ShieldAn(); shield = true; SaveData.AddValueInt("Shield", -1); Console.WriteLine("shield on"); } }