void Start() { animator = GetComponent <Animator>(); controller = GetComponent <FighterController>(); dealDamage = GetComponentInParent <DealDamage>(); fighter = GetComponentInParent <Fighter>(); }
// Start is called before the first frame update public override void Start() { base.Start(); player = GameObject.Find("Player"); sr = GetComponent <SpriteRenderer>(); dd = GetComponent <DealDamage>(); }
//setup void Awake() { //create single floorcheck in centre of object, if none are assigned if (!floorChecks) { floorChecks = new GameObject().transform; floorChecks.name = "FloorChecks"; floorChecks.parent = transform; floorChecks.position = transform.position; GameObject check = new GameObject(); check.name = "Check1"; check.transform.parent = floorChecks; check.transform.position = transform.position; Debug.LogWarning("No 'floorChecks' assigned to PlayerMove script, so a single floorcheck has been created", floorChecks); } //assign player tag if not already if (tag != "Player") { tag = "Player"; Debug.LogWarning("PlayerMove script assigned to object without the tag 'Player', tag has been assigned automatically", transform); } //usual setup mainCam = GameObject.FindGameObjectWithTag("MainCamera").transform; dealDamage = GetComponent <DealDamage>(); characterMotor = GetComponent <CharacterMotor>(); rigid = GetComponent <Rigidbody>(); aSource = GetComponent <AudioSource>(); //gets child objects of floorcheckers, and puts them in an array //later these are used to raycast downward and see if we are on the ground floorCheckers = new Transform[floorChecks.childCount]; for (int i = 0; i < floorCheckers.Length; i++) { floorCheckers[i] = floorChecks.GetChild(i); } }
//setup void Awake() { characterMotor = GetComponent<CharacterMotor>(); dealDamage = GetComponent<DealDamage>(); //avoid setup errors if(tag != "Enemy") { tag = "Enemy"; Debug.LogWarning("'EnemyAI' script attached to object without 'Enemy' tag, it has been assign automatically", transform); } if(sightBounds) { sightTrigger = sightBounds.GetComponent<TriggerParent>(); if(!sightTrigger) Debug.LogError("'TriggerParent' script needs attaching to enemy 'SightBounds'", sightBounds); } if(!sightBounds) Debug.LogWarning("Assign a trigger with 'TriggerParent' script attached, to 'SightBounds' or enemy will not be able to see", transform); if(attackBounds) { attackTrigger = attackBounds.GetComponent<TriggerParent>(); if(!attackTrigger) Debug.LogError("'TriggerParent' script needs attaching to enemy 'attackBounds'", attackBounds); } else Debug.LogWarning("Assign a trigger with 'TriggerParent' script attached, to 'AttackBounds' or enemy will not be able to attack", transform); }
public override void Draw(GameTime gameTime) { _elapsedSinceLastAnimationChange += gameTime.ElapsedGameTime; if (_elapsedSinceLastAnimationChange > (_inAttackAnimation ? AttackAnimationStepTime : _animationStepTime)) { _elapsedSinceLastAnimationChange = TimeSpan.Zero; _currentAnimationStepIndex++; if (_currentAnimationStepIndex == _animationStepCount) { _currentAnimationStepIndex = 0; if (_inAttackAnimation) { DealDamage?.Invoke(this); } _inAttackAnimation = false; } } var source = new Rectangle(_currentAnimationStepIndex * _spriteWidth, (_animationIndex + (_inAttackAnimation ? 4 : 0)) * _spriteHeight, _spriteWidth, _spriteHeight); ((Game1)Game).SpriteBatch.Draw(_sprite, Position - new Vector2(_spriteWidth / 2f, _spriteHeight / 2f), source, _color); base.Draw(gameTime); }
public void createEnemies(int faction) { GameObject newEnemy = Instantiate(enemies[choice], transform.position + new Vector3(0, 1f, 0), transform.rotation, GetComponentInParent <Spawn>().gameObject.transform); if (choice == 0) { MeleeEnemy setup = newEnemy.GetComponent <MeleeEnemy>(); setup.healthMax = meleeNums.enemyHealth; //10 setup.speed = meleeNums.enemySpeed; //2 setup.gravity = meleeNums.enemyGravity; //20 setup.attackRange = meleeNums.attackRange; //5 setup.chargeTime = meleeNums.chargeTime; //5 setup.postLockTime = meleeNums.postLockTime; //2 setup.chargeDist = meleeNums.chargeDist; //10 setup.orig = GetComponentInParent <ScalingTracker>().factionMats[faction]; setup.faction = faction; DealDamage dmgSetup = newEnemy.GetComponent <DealDamage>(); dmgSetup.damage = meleeNums.enemyDamage;//5 } else { MainRanged setup = newEnemy.GetComponent <MainRanged>(); setup.RoF = rangedNums.RoF; setup.radius = rangedNums.radius; setup.turnSpeed = rangedNums.turnSpeed; setup.healthMax = rangedNums.healthMax; setup.height = rangedNums.height; setup.orig = GetComponentInParent <ScalingTracker>().factionMats[faction]; setup.faction = faction; ProjectileValues dmgSetup = newEnemy.GetComponentInChildren <ProjectileValues>(); dmgSetup.damage = rangedNums.damage;//5 } }
void Start() { //Create a Deal Damage Component for us. DoDamage = gameObject.AddComponent <DealDamage> (); // get rigidbody component rb = GetComponent <Rigidbody> (); }
private int CalcDamage(DealDamage damage) { // First check for immunities, then resistance, then vulnerability (p. 197 Player's Handbook) if (Immunities.Contains(damage.DamageType)) { return(0); } int actualHpDamage = damage.Hp; // Resistances and vulnerabilities do not stack, so one does as much as multiple. if (Resistances.Contains(damage.DamageType)) { actualHpDamage /= 2; // integer division correctly rounds down } // It is technically possible to have a resistance and a vulnerability for the same damage type. // https://rpg.stackexchange.com/a/167448 if (Vulnerabilities.Contains(damage.DamageType)) { actualHpDamage *= 2; } return(actualHpDamage); // Possible future refactor: It's a little bit inefficient to check all of the // lists every time, especially since this function is called from in a loop. }
//setup void Awake() { //create single floorcheck in centre of object, if none are assigned if(!floorChecks) { floorChecks = new GameObject().transform; floorChecks.name = "FloorChecks"; floorChecks.parent = transform; floorChecks.position = transform.position; GameObject check = new GameObject(); check.name = "Check1"; check.transform.parent = floorChecks; check.transform.position = transform.position; Debug.LogWarning("No 'floorChecks' assigned to PlayerMove script, so a single floorcheck has been created", floorChecks); } //assign player tag if not already if(tag != "Player") { tag = "Player"; Debug.LogWarning ("PlayerMove script assigned to object without the tag 'Player', tag has been assigned automatically", transform); } //usual setup mainCam = GameObject.FindGameObjectWithTag("MainCamera").transform; dealDamage = GetComponent<DealDamage>(); characterMotor = GetComponent<CharacterMotor>(); rigid = GetComponent<Rigidbody>(); aSource = GetComponent<AudioSource>(); //gets child objects of floorcheckers, and puts them in an array //later these are used to raycast downward and see if we are on the ground floorCheckers = new Transform[floorChecks.childCount]; for (int i=0; i < floorCheckers.Length; i++) floorCheckers[i] = floorChecks.GetChild(i); }
public void MyCode() { // The FIRST line of code should be BELOW this line AggregationCalculation <bool, bool> deadCalc = new Dead(); AggregationCalculation <int, int> dealDamageCalc = new DealDamage(); ApplyCalculation <int> receiveDamageApply = new ReceiveDamageOneGetsAll(); ApplyAction logSurvivorApply = new LogSurvivor(); CharacterGroup redTeam = new CharacterGroup("Team Red", deadCalc, dealDamageCalc, receiveDamageApply, logSurvivorApply); redTeam.AddCharacter(new Defender("Thorbjorn", 340, 8, 12)); redTeam.AddCharacter(new Character("Angor", 200, 15, 25)); redTeam.AddCharacter(new Character("Zurin", 170, 18, 30)); redTeam.AddCharacter(new Damager("Allarin", 100, 15, 25)); CharacterGroup greenTeam = new CharacterGroup("Team Green", deadCalc, dealDamageCalc, receiveDamageApply, logSurvivorApply); greenTeam.AddCharacter(new Defender("Olaf", 400, 7, 13)); greenTeam.AddCharacter(new Character("Baldur", 210, 12, 18)); greenTeam.AddCharacter(new Character("Eliza", 160, 20, 35)); greenTeam.AddCharacter(new Damager("Bezuron", 90, 10, 30)); BattleHandler.DoBattle(redTeam, greenTeam); // The LAST line of code should be ABOVE this line }
public void DealDamages_ShouldSumAllDamage_WhenMultipleDamages() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 1 }, new DealDamage { DamageType = DamageTypes.Cold, Hp = 2 }, new DealDamage { DamageType = DamageTypes.Necrotic, Hp = 3 }, new DealDamage { DamageType = DamageTypes.Psychic, Hp = 4 }, }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(32); }
public void Hurt(DealDamage source, float amount) { this.health -= amount; this.source = source.gameObject; if (source.IsProjectile()) { this.source = source.GetComponent <Bullet>().source.gameObject; } this.ChangeColor(); this.isHurt = true; if (this.movement != null) { float distance = Vector3.Distance(this.transform.position, source.transform.position); this.movement.Push(source.transform.forward, this.pushPower, distance); this.movement.enabled = false; this.hurtTimer.StartTimer(() => { this.movement.enabled = true; this.isHurt = false; }, almostFinish: () => { this.ResetColor(); }); } if (this.health <= 0) { Destroy(this.gameObject); } }
// Use this for initialization void Start() { //We're supposed to be on the same gameobject as the PlayerMove, //CharacterMotor etc, so lets get them as reference! playerMove = GetComponent <PlayerMove>(); characterMotor = GetComponent <CharacterMotor>(); DoDamage = GetComponent <DealDamage>(); //Did you even make a PunchBox? Or you were lazy and didn't make one? if (!PunchHitBox) { GameObject GameObjectPunchHitBox = new GameObject(); PunchHitBox = GameObjectPunchHitBox.AddComponent <BoxCollider>(); //GameObjectPunchHitBox.collider.isTrigger = true; GameObjectPunchHitBox.transform.parent = transform; //Let's place it a little but farther away from us. GameObjectPunchHitBox.transform.localPosition = new Vector3(0f, 0f, 1f); //It should Ignore Raycast so let's put it on layer 2. GameObjectPunchHitBox.layer = 2; Debug.LogWarning("You were too lazy to make a PunchHitBox so I made one for you, happy?", GameObjectPunchHitBox); } //Also lets turn off our PunchHitBox, we'll only turn that on while punching //so the Grabbing script doesn't get confused with it. PunchHitBox.enabled = false; }
public async Task DealDamageAsync() { // Arrange var id = Guid.NewGuid(); var character = new Character("SomeName", new HitPoints(42)); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 1 }, new DealDamage { DamageType = DamageTypes.Cold, Hp = 2 } }; _characterRepository.Setup(x => x.GetByIdAsync(It.Is <Guid>(expected => expected == id))) .ReturnsAsync(character); _characterRepository.Setup(x => x.SaveAsync(It.IsAny <Character>())); _eventBus.Setup(x => x.PublishAsync <CharacterView>(It.IsAny <CharacterView>())); // Act CharacterView result = await _instance.DealDamageAsync(id, damages); // Assert _characterRepository.Verify(x => x.SaveAsync(It.Is <Character>(expected => expected == character)), Times.Once); _eventBus.Verify(x => x.PublishAsync <CharacterView>(It.Is <CharacterView>(expected => expected == result)), Times.Once); result.CurrentHp.Should().Be(39); }
public void Execute(TriggerEvent triggerEvent) { if (dealDamageGroup.HasComponent(triggerEvent.Entities.EntityA)) { if (damageGroup.Exists(triggerEvent.Entities.EntityB)) { DealDamage dealDamage = dealDamageGroup[triggerEvent.Entities.EntityA]; damageGroup[triggerEvent.Entities.EntityB].Add(new Damage { DamageTypeId = dealDamage.DamageTypeId, Value = dealDamage.Value }); } } if (dealDamageGroup.HasComponent(triggerEvent.Entities.EntityB)) { if (damageGroup.Exists(triggerEvent.Entities.EntityA)) { DealDamage dealDamage = dealDamageGroup[triggerEvent.Entities.EntityB]; damageGroup[triggerEvent.Entities.EntityA].Add(new Damage { DamageTypeId = dealDamage.DamageTypeId, Value = dealDamage.Value }); } } }
void Start() { playerMove = GetComponent<PlayerMove>(); characterMotor = GetComponent<CharacterMotor>(); DoDamage = GetComponent<DealDamage>(); PoundHitBox.enabled = false; }
private IEnumerator Attack() { while (true) { DealDamage?.Invoke(_damage); yield return new WaitForSeconds(_attackCooldown); } }
public override float CalculateWeight(string name) { GameObject agent = GameObject.Find(name); DealDamage DD = agent.GetComponent <DealDamage>(); float LinearCur = LinearFunction(DD.damageFrequnce, DD.maxFrequency); float quadCur = QuadraticCurves(DD.damageFrequnce, DD.maxFrequency, 0.2f); return(quadCur); }
public override void Actions(string name) { agent = GameObject.Find(name); DealDamage dd = agent.GetComponent <DealDamage>(); Movement movement = agent.GetComponent <Movement>(); StartCoroutine(dd.RotateTowardsTarget(GameObject.Find("Player").transform.position)); movement.SetDestination(GameObject.Find("Player").transform.position); UtilityBasedAI.actionComplete = true; }
public override void Actions(string name) { UtilityBasedAI UBA = GameObject.Find(name).GetComponent <UtilityBasedAI>(); if (!UBA.runOnce) { DealDamage dd = GameObject.Find(name).GetComponent <DealDamage>(); dd.RotateTowardsTarget(GameObject.Find("Player").transform.position); dd.ThrowGrenade(name); } }
//Averaging the values to create a score public override float CalculateScore(string name) { GameObject agent = GameObject.Find(name); dd = agent.GetComponent <DealDamage>(); float num1 = dd.damageFrequnce; float num2 = agent.GetComponent <Movement>().movementFrequency; float distance = Vector3.Distance(GameObject.Find("Player").transform.position, agent.transform.position); return(((num1 + distance) / 2) / (agent.GetComponent <DealDamage>().maxFrequency + 70)); }
void Start() { target = PlayerManager.Instance.player.transform.GetChild(0); agent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); dealDamage = GetComponentInChildren <DealDamage>(); timer = GetComponent <Timer>(); timer.onTimerRestart += OnTimerRestart; timer.onTimerEnd += OnTimerEnd; InvokeRepeating("RandomMovement", 1f, Random.Range(10, 20)); }
private void OnTriggerEnter2D(Collider2D collision) { if (hitLayers == (hitLayers | (1 << collision.gameObject.layer))) { Explode(transform.position, transform.rotation); DealDamage dealDamage = gameObject.GetComponent <DealDamage>(); ITakeDamage takeDamage = collision.gameObject.GetComponent <ITakeDamage>(); if (dealDamage != null && takeDamage != null) { takeDamage.SufferDamage(dealDamage.damage); } } }
private void OnCollisionEnter(Collision other) { var unit = other.gameObject.GetComponent <Unit>(); if (unit && !_isDead) { _isDead = true; var dealDamage = new DealDamage(); dealDamage.Amount = Damage; dealDamage.UnitID = unit.UnitID; EventDispatcher.Instance.Enqueue(dealDamage); Destroy(gameObject); } }
private void OnCollisionEnter(Collision collision) { Debug.Log("Player hit " + collision.gameObject.tag); if (collision.gameObject.tag == "Obstacle") { currentDealDamage = collision.gameObject.GetComponent <DealDamage>(); if (currentDealDamage) { Debug.Log("Player takes Damage: " + currentDealDamage.damage); GameManager.instance.TakeDamage(currentDealDamage.damage); currentDealDamage.FadeRed(); } } }
public void DealDamages_ShouldSubtractHp() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 5 }, }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(37); }
//setup void Awake() { characterMotor = GetComponent <CharacterMotor>(); dealDamage = GetComponent <DealDamage>(); if (sightBounds) { sightTrigger = sightBounds.GetComponent <TriggerParent>(); } if (attackBounds) { attackTrigger = attackBounds.GetComponent <TriggerParent>(); } wanderBasePosition = transform.position; InvokeRepeating(nameof(Wander), 0, wanderTime); }
protected virtual void Awake() { lockOnMovement = GetComponent <LockOnMovement> (); movement = GetComponent <Movement> (); animator = GetComponent <Animator> (); lockOn = false; blocking = false; Cursor.visible = false; state = CharacterState.DEFAULT; rB = GetComponent <Rigidbody> (); characterInput = (ICharacterInput)GetComponent(typeof(ICharacterInput)); direction = Vector3.zero; targetControl = GetComponent <Targets> (); damageDealing = GetComponent <DealDamage> (); health = GetComponent <Health> (); characterCollider = GetComponent <CapsuleCollider> (); }
//Find the nearest health station public override void Actions(string name) { healthStations.Clear(); agent = GameObject.Find(name); Movement move = agent.GetComponent <Movement>(); DealDamage dd = agent.GetComponent <DealDamage>(); foreach (GameObject healthStat in GameObject.FindGameObjectsWithTag("HealthStation")) { healthStations.Add(Vector3.Distance(agent.transform.position, healthStat.transform.position), healthStat.transform.position); } distance = healthStations.Min(x => x.Key); move.SetDestination(healthStations.FirstOrDefault(y => y.Key == distance).Value); move.movementFrequency -= 0.1f; }
public void DealDamages_ShouldNotHaveNegativeHP_WhenDamageIsMoreThanCurrent() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 45 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(0); instance.DeathSavingThrowFailures.Should().Be(0); instance.Status.Should().Be(LifeStatuses.Dying); }
public void DealDamages_ShouldDoDoubleDamage_WhenVulnerability() { // Arrange var instance = new HitPoints(42); instance.AddVulnerability(DamageTypes.Fire); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 5 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(32); }
public void DealDamages_ShouldChangeStatusToDead_WhenRemainingDamageIsMaxOrMore() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 84 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(0); instance.DeathSavingThrowFailures.Should().Be(0); instance.Status.Should().Be(LifeStatuses.Dead); }
public void DealDamages_ShouldChangeStatusToDying_WhenStableAndDamageIsSameAsCurrent() { // Arrange var instance = new HitPoints(42); var damages = new DealDamage[] { new DealDamage { DamageType = DamageTypes.Fire, Hp = 42 } }; // Act instance.DealDamages(damages); // Assert instance.CurrentHp.Should().Be(0); instance.DeathSavingThrowFailures.Should().Be(0); instance.Status.Should().Be(LifeStatuses.Dying); }
// Update is called once per frame public void Change(int ? id = null) { if (id == null) playerid = 0; else playerid = (int)id; Player_PF = main_process.GetPlayerObject(id); Player_Script = main_process.GetPlayerScript(id); Player_EXP = main_process.GetPlayerExperience(id); Player_Health = Player_PF.GetComponent<Health>(); Player_Mana = Player_PF.GetComponent<Mana>(); Player_Defense = Player_PF.GetComponent<Defense>(); Player_ATK = Player_Script.AttackCollider.GetComponent<DealDamage>(); //if (!Player_ATK) // Debug.Log("Cannot Get Player_ATK"); ATK.text = Player_Script.GetTotalStrength().ToString(); DEF.text = Player_Defense.defense.ToString(); STA.text = Player_Script.GetTotalStamina().ToString(); SPI.text = Player_Script.GetTotalIntelligence().ToString(); AGI.text = Player_Script.GetTotalAgility().ToString(); BATK.text = "<color=#ffffffff>" + Player_ATK.GetDamageI().ToString() + "-" + Player_ATK.GetDamageI().ToString() + "</color>"; MATK.text = "<color=#ffffffff>" + Player_ATK.GetDamageI().ToString() + "-" + Player_ATK.GetDamageI().ToString() + "</color>"; PDEF.text = Player_Defense.GetPhysicalDefense().ToString(); MDEF.text = Player_Defense.GetMagicalDefense().ToString(); //CRIR.text = (Player_ATK.GetCriticalChance()*100).ToString()+"%"; C_ICON.sprite = CI.Class_info[Player_Script.GetClassID()].icon; C_HP.text = Player_Health.GetCurrentHealth().ToString() + "/" + Player_Health.GetMaxHP().ToString(); CRIR.text = "0.00%"; C_MP.text = Player_Mana.GetMana().ToString() + "/" + Player_Mana.MaxMana.ToString(); C_LV.text = Player_EXP.GetCurrentLevel().ToString(); C_EXP.text = Player_EXP.GetExperience().ToString(); C_NEXP.text = (Player_EXP.GetNEXP()-Player_EXP.GetExperience()).ToString(); C_Name.text = Player_Script.Player_Name; weapon.sprite = CI.Class_info[Player_Script.GetClassID()].weapon[Player_Script.GetWeaponLV()].icon; amror.sprite = CI.Class_info[Player_Script.GetClassID()].armor[Player_Script.GetAmrorLV()].icon; accer.sprite = CI.Class_info[Player_Script.GetClassID()].accessory[Player_Script.GetAccessoriesLV()].icon; C_PASP.text = Player_PF.GetComponent<PassiveSkillManager>().getAvailablePoints().ToString(); select_current = 1; gem_selecting = false; passive_selecting = false; gem_system.manager = main_process.GetPlayerGemManager(playerid); }
void Start() { // Create a Deal Damage Component for us. DoDamage = gameObject.AddComponent<DealDamage>(); }
void Awake() { damage = GetComponent<DealDamage>(); InvincibilityCollider.enabled = false; }
void Awake() { dealDamage = GetComponent<DealDamage>(); }
//setup void Awake() { GetComponent<AudioSource>().playOnAwake = false; dealDamage = GetComponent<DealDamage>(); }
// setup void Awake() { // create single floorcheck in centre of object, if none are assigned if (!m_floorChecks) { m_floorChecks = new GameObject().transform; m_floorChecks.name = "FloorChecks"; m_floorChecks.parent = transform; m_floorChecks.position = transform.position; GameObject check = new GameObject(); check.name = "Check1"; check.transform.parent = m_floorChecks; check.transform.position = transform.position; Debug.LogWarning("No 'floorChecks' assigned to PlayerMove script, so a single floorcheck has been created", m_floorChecks); } // assign player tag if not already if (tag != Tags.Player) { tag = Tags.Player; Debug.LogWarning("PlayerMove script assigned to object without the tag 'Player', tag has been assigned automatically", transform); } // usual setup m_mainCam = GameObject.FindGameObjectWithTag(Tags.MainCamera).transform; dealDamage = GetComponent<DealDamage>(); characterMotor = GetComponent<CharacterMotor>(); m_Collider = GetComponent<Collider>(); // gets child objects of floorcheckers, and puts them in an array // later these are used to raycast downward and see if we are on the ground floorCheckers = new Transform[m_floorChecks.childCount]; for (int i = 0; i < floorCheckers.Length; i++) floorCheckers[i] = m_floorChecks.GetChild(i); OriginalMaxAccel = m_accel; OriginalMaxSpeed = m_maxSpeed; }
// Use this for initialization void Start() { moveIncrement = new Vector3(1, -2, 0); dealDamage = GetComponent<DealDamage>(); Destroy(gameObject, 5); }
public void Start() { dealDamage = GetComponent<DealDamage>(); Destroy(transform.gameObject, TimeToLive); }
// Use this for initialization void Start() { base.Start(); ai = GetComponent<AI>(); spike = MutationInstance.GetComponent<DealDamage>(); }
//setup void Awake() { audio.playOnAwake = false; dealDamage = GetComponent<DealDamage>(); }
/* void Awake() { if (player == null) { player = gameObject; }else if(player != gameObject) { Destroy(gameObject); } }*/ void Start() { state = new StandingState(); attackState = new IdleAttackState(); animator = GetComponent<Animator>(); skillManager = gameObject.AddComponent<SkillManager>(); AttackCollider.SetActive(false); health = GetComponent<Health>(); controller = GetComponent<MoveController>(); crowdControllable = GetComponent<CrowdControllable>(); mana = GetComponent<Mana>(); attack = GetComponentInChildren<DealDamage>(); defense = GetComponent<Defense>(); attackController = GetComponent<AttackController>(); gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; audiosource = GetComponent<AudioSource>(); initialRegenTime = 6; regenTick = 2; DontDestroyOnLoad(gameObject); skill[0] = null; skill[1] = null; skill[2] = null; skill[3] = null; threatLevel = damageDealt = 0; GetComponent<ID>().setTime(false); CCI = GameObject.Find("Main Process").GetComponentInChildren<Character_Class_Info>(); si = GameObject.Find("Main Process").GetComponentInChildren<Skill_info>(); Fully_Update(); }
// Use this for initialization void Start() { //We're supposed to be on the same gameobject as the PlayerMove, //CharacterMotor etc, so lets get them as reference! m_playerMove = GetComponent<PlayerMove>(); m_characterMotor = GetComponent<CharacterMotor>(); DoDamage = GetComponent<DealDamage>(); m_Sliding = GetComponent<Sliding>(); m_rigidBody = GetComponent<Rigidbody>(); //Did you even make a PunchBox? Or you were lazy and didn't make one? if (!PunchHitBox) { GameObject GameObjectPunchHitBox = new GameObject(); PunchHitBox = GameObjectPunchHitBox.AddComponent<BoxCollider>(); GameObjectPunchHitBox.GetComponent<Collider>().isTrigger = true; GameObjectPunchHitBox.transform.parent = transform; //Let's place it a little but farther away from us. GameObjectPunchHitBox.transform.localPosition = new Vector3(0f, 0f, 1f); //It should Ignore Raycast so let's put it on layer 2. GameObjectPunchHitBox.layer = 2; Debug.LogWarning("You were too lazy to make a PunchHitBox so I made one for you, happy?", GameObjectPunchHitBox); } //Also lets turn off our PunchHitBox, we'll only turn that on while punching //so the Grabbing script doesn't get confused with it. //PunchHitBox.enabled = false; }
void Start() { dDamage = GetComponent<DealDamage>(); }