private void Awake() { Statistics = this.GetComponent <CharacterStatistics>(); name = Statistics.name; PlayerMovement = this.GetComponent <PlayerMovement>(); craftmenu = getChildGameObject(gameObject, "CraftMenu"); playerInfo = GetComponent <Player>(); _equipmentManager = GetComponent <EquipmentManager>(); isShooting = false; switch (name) { case "Swayne The Rock": currentWeapon = (IWeapon)getChildGameObject(gameObject, "akm_end").GetComponent <AKMShooting>(); if (anim.GetLayerWeight(currentWeapon.GetLayerNumber()) != 1.0f) { // if not active yet resetWeight(); anim.SetLayerWeight(currentWeapon.GetLayerNumber(), 1.0f); } break; case "Gaara": currentWeapon = (IWeapon)getChildGameObject(gameObject, "Katana").GetComponent <Katana>(); if (anim.GetLayerWeight(currentWeapon.GetLayerNumber()) != 1.0f) { // if not active yet resetWeight(); anim.SetLayerWeight(currentWeapon.GetLayerNumber(), 1.0f); } break; } number_of_layer = 3; //isAnimationWorking = false; }
public void OnStatButtonPressed(string stat) { CharacterStatType statSelected = CharacterStatistics.StatTypeFromString(stat); int currentLevel = Game.instance.playerStats.BaseStatValue(statSelected); int cost = UpgradeCost(statSelected); if (Game.instance.playerData.numHearts >= cost) { Game.instance.playerData.numHearts -= cost; NumberPopupGenerator.instance.GeneratePopup(Game.instance.avatar.gameObject, cost, NumberPopupReason.RemoveHearts); if (statSelected == CharacterStatType.MaxHealth) { Game.instance.playerStats.ChangeBaseStat(statSelected, currentLevel + mHealthPerLevel); Game.instance.playerData.health = Game.instance.avatar.GetComponent <CharacterStatistics>().ModifiedStatValue(CharacterStatType.MaxHealth, Game.instance.avatar.gameObject); } else { Game.instance.playerStats.ChangeBaseStat(statSelected, currentLevel + 1); } Game.instance.cinematicDirector.PostCinematicEvent("trainer_success"); Game.instance.soundManager.PlaySound("confirm_special"); } else { Game.instance.cinematicDirector.PostCinematicEvent("trainer_fail"); } Close(); }
private void Awake() { if (mInstance != null) { Destroy(gameObject); return; } UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnActiveSceneChanged; mInstance = this; DontDestroyOnLoad(gameObject); mPlayerStats = GetComponentInChildren <CharacterStatistics>(); mSaveManager = GetComponent <SaveManager>(); mTransitionManager = GetComponentInChildren <ScreenTransitionManager>(); mCinematicDirector = GetComponentInChildren <CinematicDirector>(); mCinematicDataProvider = GetComponentInChildren <CinematicDataProvider>(); mCharacterStatInfo = GetComponentInChildren <CharacterStatInfo>(); mCentralEvents = new CentralEvents(); mCompanionBuilder = GetComponentInChildren <CompanionBuilder>(); mEnemyDirector = GetComponentInChildren <EnemyDirector>(); mSoundManager = GetComponentInChildren <SoundManager>(); mQuirkRegistry = GetComponentInChildren <QuirkRegistry>(); mSaveManager.LoadGame(); playerData.onPlayerDataChanged += OnPlayerDataChanged; playerStats.onCharacterStatisticsChanged += OnPlayerStatsChanged; }
private void Start() { if (!isLocalPlayer) { return; } LineRenderer lineRenderer = gameObject.GetComponent <LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Particles/Additive")); lineRenderer.widthMultiplier = 1f; lineRenderer.positionCount = 3; lineRenderer.receiveShadows = false; // A simple 2 color gradient with a fixed alpha of 1.0f. float alpha = 0.6f; Gradient gradient = new Gradient(); gradient.SetKeys( new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) } ); lineRenderer.colorGradient = gradient; Statistics = this.GetComponent <CharacterStatistics>(); }
private void Start() { mEnemy = GetComponent <Enemy>(); mSummonerAI = GetComponent <EnemySummoner>(); mProjectileThrowerAI = GetComponent <EnemyProjectileThrower>(); mSpellCasterAI = GetComponent <EnemySpellCaster>(); mStatistics = GetComponent <CharacterStatistics>(); mKillable = GetComponent <Killable>(); mAllAIModules = new List <EnemyAI>() { mSummonerAI, mProjectileThrowerAI, mSpellCasterAI }; mSummonerAI.enabled = true; mCurrentActiveModule = mSummonerAI; mEnemy.SetEnemyAI(this); mKillable.onHit += OnHit; mKillable.onDeath += OnDeath; Game.instance.hud.bossHealth.gameObject.SetActive(true); Game.instance.hud.bossHealth.SetWithValues(0, mKillable.health, mKillable.health); Game.instance.hud.bossHealth.transform.localScale = Vector3.zero; Game.instance.hud.bossHealth.transform.DOScale(1f, 0.5f); }
// Use this for initialization void Awake() { agent = GetComponent <NavMeshAgent>(); //sc = GetComponent<SphereCollider>(); ZombieStats = GetComponent <CharacterStatistics>(); anim = gameObject.GetComponent <Animator>(); }
private void Start() { EquipmentManager = GetComponent <EquipmentManager>(); PlayerInventory = GetComponent <Inventory>(); PlayerStatistics = GetComponent <CharacterStatistics>(); PlayerMovement = GetComponent <PlayerMovement>(); ErrorText.enabled = false; }
void Attack() { timer = 0f; CharacterStatistics playerStatistics = player.GetComponent <CharacterStatistics>(); playerStatistics.TakeDamage(attackDamage); }
// Use this for initialization void Start() { ZombieStats = GetComponent <CharacterStatistics>(); anim = GetComponent <Animator>(); agent = GetComponent <NavMeshAgent>(); myTransform = transform; //cache transform data for easy access/preformance raycastLayer = 1 << LayerMask.NameToLayer("Player"); //target the player }
public Player(string login, Level level, Position startPosition, CharacterStatistics statistics, List <InventoryItem> inventoryItems, List <InventoryItem> appliedInventoryItems) : base(startPosition, login) { this.level = level; this.statistics = statistics; this.inventoryItems = inventoryItems; this.appliedInventoryItems = appliedInventoryItems; }
void Awake() { owner = GetComponent <CharacterStatistics>(); name = owner.name; craftmenu = getChildGameObject(gameObject, "CraftMenu"); _inventory = GetComponent <Inventory>(); _equipmentManager = GetComponent <EquipmentManager>(); weaponsList = _inventory.getWeapons(); _inventory.onItemChangedCallback += UpdateWeaponsList; //Weapon AKM = getChildGameObject(gameObject, "AKM"); //AKM.transform.SetParent(gameObject.transform, false); // to keep good scaling Gatlin = getChildGameObject(gameObject, "Gatling"); //Gatlin.transform.SetParent(gameObject.transform, false); GunFire = getChildGameObject(gameObject, "GunFire"); //GunFire.transform.SetParent(gameObject.transform, false); Katana = getChildGameObject(gameObject, "Katana"); //LocalPosition localposition = AKM.transform.localPosition; eulerangle = AKM.transform.eulerAngles; //Adapt to other weapon (Using the same animation) //Gatlin.transform.localScale = Gatlin.transform.localScale / 2; Gatlin.transform.localPosition = localposition; Gatlin.transform.eulerAngles = eulerangle; //GunFire.transform.localScale = GunFire.transform.localScale / 2; GunFire.transform.localPosition = localposition; GunFire.transform.eulerAngles = eulerangle; switch (name) { case "Swayne The Rock": activeWeapon = AKM; break; case "Gaara": activeWeapon = Katana; break; } //Todo : same for katana try to use axe // Reference to playerSHoting scriptPS = gameObject.GetComponent <PlayerShooting>(); }
public void Fire(float angle) { Debug.LogError("Time between bullet" + timeBetweenBullets); anim_weapon.Play(); Debug.LogError("Je tire Gatling"); gunAudio.Play(); // Enable the light. //gunLight.enabled = true; // Stop the particles from playing if they were, then start the particles. gunParticles.Stop(); gunParticles.Play(); // Enable the line renderer and set it's first position to be the end of the gun. gunLine.enabled = true; gunLine.SetPosition(0, transform.position); // Set the shootRay so that it starts at the end of the gun and points forward from the barrel. shootRay.origin = transform.position; //TO DO : A modifier en fonction de langle //shootRay.direction = transform.forward; float random = (float)(Random.NextDouble() * (2) - 1); Vector3 point = Quaternion.AngleAxis(random * angle, Vector3.up) * transform.forward; point.y = 0f; shootRay.direction = point; // Perform the raycast against gameobjects on the shootable layer and if it hits something... if (Physics.Raycast(shootRay, out shootHit, range, shootableMask)) { //Enemmy interaction // Try and find an EnemyHealth script on the gameobject hit. if (shootHit.collider.CompareTag("Zombie")) { CharacterStatistics zombieStatistics = shootHit.collider.GetComponent <CharacterStatistics>(); zombieStatistics.TakeDamage(damage); // Set the second position of the line renderer to the point the raycast hit. gunLine.SetPosition(1, shootHit.point); } else { gunLine.SetPosition(1, shootHit.point); } } // If the raycast didn't hit anything on the shootable layer... else { // ... set the second position of the line renderer to the fullest extent of the gun's range. gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range); } }
// Use this for initialization void Awake() { myTransform = transform; agent = GetComponent <NavMeshAgent>(); //sc = GetComponent<SphereCollider>(); ZombieStats = GetComponent <CharacterStatistics>(); anim = gameObject.GetComponent <Animator>(); raycastLayer = 1 << LayerMask.NameToLayer("Player"); //target the player }
public CharacterInfo(Player player) { Player = player; TOTAL_XP = 0; HP = MAX_HP; Stats = new CharacterStatistics(); }
public override Mob Create(string type, Level level, Position position, CharacterStatistics statistics) { return(type switch { MobType.AggressiveMob => new NetworkMob(level, new AggressiveMobBehaviour(), position, statistics), MobType.CowardMob => new NetworkMob(level, new CowardMobBehaviour(), position, statistics), MobType.PassiveMob => new NetworkMob(level, new PassiveMobBehaviour(), position, statistics), MobType.ConfusedMob => new NetworkMob(level, new PassiveMobBehaviour(), position, statistics, true), _ => throw new NotSupportedException() });
// Use this for initialization void Start() { ZombieStats = GetComponent <CharacterStatistics>(); anim = GetComponent <Animator>(); agent = GetComponent <NavMeshAgent>(); distanceDetect = 4.0f; myTransform = transform; //cache transform data for easy access/preformance //raycastLayer = 1 << LayerMask.NameToLayer("Player"); //target the player raycastLayer = 1 << 10; anim.SetBool("PlayerInView", false); }
private void Awake() { Statistics = this.GetComponent <CharacterStatistics>(); PlayerMovement = this.GetComponent <PlayerMovement>(); craftmenu = getChildGameObject(gameObject, "CraftMenu"); playerInfo = GetComponent <Player>(); _equipmentManager = GetComponent <EquipmentManager>(); isShooting = false; currentWeapon = (IWeapon)getChildGameObject(gameObject, "akm_end").GetComponent <AKMShooting>(); number_of_layer = 3; //isAnimationWorking = false; }
public virtual AbstractPlayer Create(string login, string type, Level level, Position position, CharacterStatistics statistics, List <InventoryItem> inventory, List <InventoryItem> appliedInventory) { return(type switch { PlayerType.Player => new Player(login, level, position, statistics, inventory, appliedInventory), PlayerType.ConfusedPlayer => new ConfusedPlayer(level, new Player(login, level, position, statistics, inventory, appliedInventory)), PlayerType.EnemyPlayer => new Player(login, level, position, statistics, inventory, appliedInventory), PlayerType.EnemyConfusedPlayer => new ConfusedPlayer(level, new Player(login, level, position, statistics, inventory, appliedInventory)), _ => throw new NotSupportedException() });
public void OnTriggerStay(Collider other) { if (canHit) { if (other.gameObject.tag == "Zombie") { CharacterStatistics zombieStatistics = other.GetComponent <CharacterStatistics>(); zombieStatistics.TakeDamage(damage); Debug.LogError("J'attaque au Lance Flamme"); canHit = false; } } }
public void GetCollectionOfCharacterStatistics_PassListOfStrings_GetCorrectCharacterStatistics() { //Arrange CharacterStatistics characterStatistics = new CharacterStatistics(); List <string> headers = GetListOfHeaders(); IEnumerable <KeyValuePair <char, int> > expectedStatistics = GetExpectedStatistics(); //Act IEnumerable <KeyValuePair <char, int> > results = characterStatistics.GetCollectionOfCharacterStatistics(headers); //Assert Assert.AreEqual(expectedStatistics, results); }
private void Start() { mCharacterStatistics = GetComponent <CharacterStatistics>(); if (mesh != null) { mMeshLocalPosition = mesh.transform.localPosition; } // todo bdsowers - there's a better way to do this... mCollisionMap = GameObject.FindObjectOfType <CollisionMap>(); useCollisionMap = (mCollisionMap != null); }
public Mob(Level level, IMobBehaviour behaviour, Position startPosition, CharacterStatistics statistics, bool confused = false) : base(startPosition) { Id = ++lastId; this.level = level; Behaviour = behaviour; originalBehaviour = behaviour; this.statistics = statistics; if (confused) { BecomeConfused(); } }
private static void AddSkills(IEnumerable <SkillDps> skills, CharacterStatistics characterStats) { foreach (var skill in skills.OrderByDescending(i => i.DPSBoss)) { var skillDamage = new SkillDamage { Name = skill.Name, SkillId = skill.SkillId, DamageAll = skill.PowerAll + skill.CondiAll, DamageBoss = skill.PowerBoss + skill.CondiBoss, DpsAll = Math.Round(skill.DPSAll), DpsBoss = Math.Round(skill.DPSBoss) }; characterStats.Skills.Add(skillDamage); } }
public void OnTriggerEnter(Collider other) { if (canHit) { if (other.gameObject.tag == "Zombie") { CharacterStatistics zombieStatistics = other.GetComponent <CharacterStatistics>(); zombieStatistics.TakeDamage(damage); if (name_player == "Gaara") { Debug.LogError("Je passe ici"); owner.GetComponent <Gaara>().AddFureur(40); } Debug.LogError("J'attaque au Katana"); canHit = false; } } }
private void Start() { mEnemy = GetComponent <Enemy>(); mStatistics = GetComponent <CharacterStatistics>(); mKillable = GetComponent <Killable>(); mTeleport = GetComponent <EnemyTeleport>(); mSimpleMovement = GetComponent <SimpleMovement>(); mSimpleAttack = GetComponent <SimpleAttack>(); mAnimator = GetComponentInChildren <Animator>(); mEnemy.SetEnemyAI(this); Game.instance.hud.bossHealth.gameObject.SetActive(true); Game.instance.hud.bossHealth.SetWithValues(0, mKillable.health, mKillable.health); Game.instance.hud.bossHealth.transform.localScale = Vector3.zero; Game.instance.hud.bossHealth.transform.DOScale(1f, 0.5f); }
public void ConvertLog(IEncounterLog herosLog, SharedValues sharedValues) { herosLog.Name = sharedValues.Target; herosLog.EncounterDate = sharedValues.LogStart.ToLocalTime(); herosLog.EncounterResult = sharedValues.Success ? "Success" : "Fail"; var time = TimeSpan.FromSeconds(sharedValues.FightDuration); herosLog.EncounterTime = new TimeSpan(time.Days, time.Hours, time.Minutes, time.Seconds); foreach (var sharedValuesPlayerValue in sharedValues.PlayerValues) { var characterStats = new CharacterStatistics() { Name = sharedValuesPlayerValue.Character, DisplayName = sharedValuesPlayerValue.Account.Substring(1), BossDps = Math.Round(sharedValuesPlayerValue.DPSBoss), BossDamage = sharedValuesPlayerValue.TotalBoss, AllDps = Math.Round(sharedValuesPlayerValue.DPSAll), AllDamage = sharedValuesPlayerValue.TotalAll, Down = sharedValuesPlayerValue.Down.ToString(), Role = sharedValuesPlayerValue.Profession, }; if (sharedValuesPlayerValue.Dead && sharedValuesPlayerValue.FightDurationPlayer < sharedValues.FightDuration) { var percent = (sharedValuesPlayerValue.FightDurationPlayer / sharedValues.FightDuration * 100).ToString("0"); var timeOfDead = TimeSpan.FromSeconds(sharedValuesPlayerValue.FightDurationPlayer); characterStats.Dead = $"{timeOfDead.Minutes}m {timeOfDead.Seconds}s ({percent}% alive)"; } AddSkills(sharedValuesPlayerValue.Skills, characterStats); herosLog.CharacterStatistics.Add(characterStats); } herosLog.BossDps = Math.Round(sharedValues.PlayerValues.Sum(i => i.TotalBoss) / sharedValues.FightDuration); herosLog.AllDps = Math.Round(sharedValues.PlayerValues.Sum(i => i.TotalAll) / sharedValues.FightDuration); }
void ApplyHit(GameObject collider) { Killable targetKillable = collider.GetComponentInParent <Killable>(); if (targetKillable != null && targetKillable.gameObject.layer != gameObject.layer && !mEnemiesHit.Contains(targetKillable)) { // If the victim was the player & the player has a mirror shield, reflect! if (targetKillable.gameObject.layer == LayerMask.NameToLayer("Player")) { if (Game.instance.playerStats.IsItemEquipped <MirrorShield>()) { MirrorShield shield = Game.instance.playerStats.GetComponentInChildren <MirrorShield>(); shield.Reflect(this); return; } } CharacterStatistics stats = targetKillable.GetComponent <CharacterStatistics>(); int defense = stats == null ? 0 : stats.ModifiedStatValue(CharacterStatType.Defense, targetKillable.gameObject); int damage = strength * 4 - defense * 2; mEnemiesHit.Add(targetKillable); targetKillable.TakeDamage(null, damage, DamageReason.Projectile); if (destroyOnEnemyHit) { Destroy(gameObject); PlayHitVFX(); } } else { if (destroyOnEnvironmentHit) { Destroy(gameObject); PlayHitVFX(); } } }
protected virtual void Start() { animator = GetComponent <Animator>(); _singleAnimationInsteadOfAnimator = GetComponent <Animation>(); _myStats = GetComponent <CharacterStatistics>(); _changeColorMaterial = GetComponent <ChangeColorMaterialTemporary>(); _healtBarControllerScript = GetComponent <GameCharacterHealthBarController>(); if (isAnimated) { // Calcola ora quanto dura la lunghezza della clip di morte var clips = animator.runtimeAnimatorController.animationClips; foreach (var clip in clips) { if (clip.name.Contains("Dead")) { deadAnimationTime = clip.length; } } } }
// Use this for initialization void Start() { anim = gameObject.GetComponent <Animator>(); ZombieStats = GetComponent <CharacterStatistics>(); }
void HurtPuddle() { CharacterStatistics playerStatistics = player.GetComponent <CharacterStatistics>(); playerStatistics.TakeDamage(damagePerTime); }