//-------------------------------------------------------------- // *** CONSTRUCTORS *** void Start() { // Uses the variable called agent, then uses getcomponent to determain what component is going to be placed into the agent m_agent = GetComponent <NavMeshAgent>(); _RetargetCollision = GetComponent <SphereCollider>(); _GoToTarget = GetComponent <LinearGoToTarget>(); }
//-------------------------------------------------------------- // *** CONSTRUCTORS *** public override void Start() { // Stores reference to the player associated with the character _Player = GetComponent<Player>(); _LinearGoTo = GetComponent<LinearGoToTarget>(); // Store rigidbody reference _RigidBody = GetComponent<Rigidbody>(); // Store animator controller reference _Animator = GetComponent<Animator>(); // Set character's health & get collision reference _StartingHealth = PlayerManager._pInstance._GeomancerStartingHealth; base.Start(); // Set OnDeath effect _EffectOnDeath = PlayerManager._pInstance._OnDeathEffect; // Set character's speed _MovementSpeed = PlayerManager._pInstance._GeomancerMovementSpeed; // Set dash properties _DashEnabled = PlayerManager._pInstance._DashEnabled; _DashInputButton = PlayerManager._pInstance._DashButton; _DashDistance = PlayerManager._pInstance._DashDistance; _DashCooldown = PlayerManager._pInstance.DashCooldown; // Set knockback properties _KnockbackEnabled = PlayerManager._pInstance._KnockbackEnabled; _KnockbackInputButton = PlayerManager._pInstance._KnockbackButton; _KnockbackForceNormal = PlayerManager._pInstance._KnockbackForceNormal; _KnockbackForceDash = PlayerManager._pInstance.KnockbackForceDash; _KnockbackCooldown = PlayerManager._pInstance._KnockbackCooldown; // Set invincibility properties _InvincibleTime = DeviceManager._pInstance._InvincibilityTime; _InvincibleMaterial = PlayerManager._pInstance._InvincibleMaterial; // Set tabbing weapon input _TabInputButton = PlayerManager._pInstance._WeaponSwapButton; // Get random dialog and assign it to the player _CharacterDialog = SoundManager._pInstance.GetRandomDialog(); _CharacterDialog.SetPlayer(_Player); // Set the owner for the voxel sounds foreach (var tauntSound in _CharacterDialog._TauntSounds) { tauntSound._Owner = this; } // Set's either the orb or the flamethrower as the primary depending on whats specified in the player manager switch (PlayerManager._pInstance._PrimaryWeapon) { case PlayerManager.WeaponList.Orb: { // Create players's primary weapon (orb) _WeaponPrimary = GameObject.FindGameObjectWithTag("P" + _Player._pPlayerID + "_OrbWeapon").GetComponent<Weapon>(); if (_WeaponPrimary != null) { // Initialize PRIMARY weapon _WeaponPrimary.SetOwner(this); _WeaponPrimary.Init(); /// Create fireball object pool (inactive projectiles) } // Create players's secondary weapon (flamethrower) _WeaponSecondary = GameObject.FindGameObjectWithTag("P" + _Player._pPlayerID + "_FlamethrowerWeapon").GetComponent<Weapon>(); if (_WeaponSecondary != null) { // Initialize SECONDARY weapon _WeaponSecondary.SetOwner(this); _WeaponSecondary.Init(); /// Create flamethrower object pool (inactive projectiles) } break; } case PlayerManager.WeaponList.Flamethrower: { // Create players's primary weapon (flamethrower) _WeaponPrimary = GameObject.FindGameObjectWithTag("P" + _Player._pPlayerID + "_FlamethrowerWeapon").GetComponent<Weapon>(); if (_WeaponPrimary != null) { // Initialize PRIMARY weapon _WeaponPrimary.SetOwner(this); _WeaponPrimary.Init(); /// Create flamethrower object pool (inactive projectiles) } // Create players's secondary weapon (orb) _WeaponSecondary = GameObject.FindGameObjectWithTag("P" + _Player._pPlayerID + "_OrbWeapon").GetComponent<Weapon>(); if (_WeaponSecondary != null) { // Initialize SECONDARY weapon _WeaponSecondary.SetOwner(this); _WeaponSecondary.Init(); /// Create fireball object pool (inactive projectiles) } break; } default: { break; } } // Create player's special weapon (shield) _WeaponSpecial = GameObject.FindGameObjectWithTag("P" + _Player._pPlayerID + "_ShieldWeapon").GetComponent<Weapon>(); if (_WeaponSpecial != null) { // Initialize SPECIAL weapon _WeaponSpecial.SetOwner(this); _WeaponSpecial.Init(); /// Create minion object pool (empty) } // Can be controlled by player / ai controller SetActive(true); // Add the gameObject associated to this script to the playermanager object pools PlayerManager._pInstance.GetActiveNecromancers().Add(this); PlayerManager._pInstance.GetAllPlayers().Add(this); }
//-------------------------------------------------------------- // *** CONSTRUCTORS *** public override void Start() { // Get base character references base.Start(); // Get behaviour references _BehaviourWander = GetComponent <Behaviour_Wander>(); _BehaviourFlee = GetComponent <Behaviour_Flee>(); _BehaviourSeek = GetComponent <Behaviour_Seek>(); _LinearSeek = GetComponent <LinearGoToTarget>(); switch (_Type) { // MINOR VARIANT case CrystalType.Minor: { // Initialize _StartingHealth = AiManager._pInstance._CrystalMinorStartingHealth; _MovementSpeed = AiManager._pInstance._CrystalMinorMovementSpeed; _PickupType = AiManager._pInstance._CrystalMinorTagType; _MeshRenderer.material = AiManager._pInstance._CrystalMinorTypeMaterial; _SpawningTime = AiManager._pInstance._CrystalMinorSpawningTime; _EffectOnDeath = AiManager._pInstance._MinorOnDeathEffect; switch (AiManager._pInstance._CrystalMinorBehaviourType) { case AiManager.AiBehaviourType.Wander: { _BehaviourWander.enabled = true; break; } case AiManager.AiBehaviourType.Flee: { _BehaviourFlee.enabled = true; break; } case AiManager.AiBehaviourType.Seek: { _BehaviourSeek.enabled = true; break; } case AiManager.AiBehaviourType.Mixed: { break; } default: { break; } } break; } // MAJOR VARIANT case CrystalType.Major: { // Initialize _StartingHealth = AiManager._pInstance._CrystalMajorStartingHealth; _MovementSpeed = AiManager._pInstance._CrystalMajorMovementSpeed; _PickupType = AiManager._pInstance._CrystalMajorTagType; _MeshRenderer.material = AiManager._pInstance._CrystalMajorTypeMaterial; _SpawningTime = AiManager._pInstance._CrystalMajorSpawningTime; _EffectOnDeath = AiManager._pInstance._MajorOnDeathEffect; switch (AiManager._pInstance._CrystalMajorBehaviourType) { case AiManager.AiBehaviourType.Wander: { _BehaviourWander.enabled = true; break; } case AiManager.AiBehaviourType.Flee: { _BehaviourFlee.enabled = true; break; } case AiManager.AiBehaviourType.Seek: { _BehaviourSeek.enabled = true; break; } case AiManager.AiBehaviourType.Mixed: { break; } default: { break; } } break; } // CURSED VARIANT case CrystalType.Cursed: { // Initialize _StartingHealth = AiManager._pInstance._CrystalMajorStartingHealth; _MovementSpeed = AiManager._pInstance._CrystalMajorMovementSpeed; _PickupType = AiManager._pInstance._CrystalCursedTagType; _MeshRenderer.material = AiManager._pInstance._CrystalCursedTypeMaterial; _SpawningTime = AiManager._pInstance._CrystalCursedSpawningTime; _EffectOnDeath = AiManager._pInstance._CursedOnDeathEffect; switch (AiManager._pInstance._CrystalCursedBehaviourType) { case AiManager.AiBehaviourType.Wander: { _BehaviourWander.enabled = true; break; } case AiManager.AiBehaviourType.Flee: { _BehaviourFlee.enabled = true; break; } case AiManager.AiBehaviourType.Seek: { _BehaviourSeek.enabled = true; break; } case AiManager.AiBehaviourType.Mixed: { break; } default: { break; } } break; } default: { break; } } // Reset health now that starting health has been updated _Health = _StartingHealth; // Store the new material that has been applied to the character _OriginalMaterial = _MeshRenderer.material; }
//-------------------------------------------------------------- // *** CONSTRUCTORS *** void Start() { _agent = GetComponent <NavMeshAgent>(); _RetargetCollision = GetComponent <SphereCollider>(); _GoToTarget = GetComponent <LinearGoToTarget>(); }