Exemplo n.º 1
0
    private void OnEnable()
    {
        mort = GetComponent <Mortal>();

        mort.onHit -= callResponse;
        mort.onHit += callResponse;
    }
Exemplo n.º 2
0
        public void SimAtk(Mortal Attacker, Mortal Reciever)
        {
            if (Reciever.Health >= 0)
            {
                UpdateStats();
                MakeSoundEffect();
                _counter             = 0;
                tmrAnimation.Enabled = true;
                tmrAnimation.Start();
                float prevEnemyHealth = Reciever.Health;
                Attacker.SimpleAttack(Reciever);
                PartyDamage         = +(float)Math.Round(prevEnemyHealth - Reciever.Health);
                MidFightlabel.Text += Attacker.Name + " attacked. ";
                if (enemy.Health <= 0)
                {
                    float X = enemy.XpDropped;
                    character.GainXP(X);
                    roll.GainXP(X);
                    rush.GainXP(X);
                    character.GainGb(enemy.GbDropped);
                    character.GainPt(enemy.PtDropped);

                    MidFightlabel.Text        += " Damage dealt by party = " + Math.Round(PartyDamage);
                    MidFightlabel.Visible      = true;
                    lblEndFightMessage.Text    = "You Gained " + Math.Round(enemy.XpDropped) + " xp and" + Math.Round(enemy.GbDropped) + " gb and" + Math.Round(enemy.PtDropped) + " Pt!";
                    lblEndFightMessage.Visible = true;
                    Refresh();
                    Thread.Sleep(1200);
                    EndFight();
                    LevelUpcheck();
                }
            }
        }
Exemplo n.º 3
0
 public void OnInitializedHandler(Mortal mortal)
 {
     _text = GetComponent <Text>();
     if (targetMortal != null)
     {
         _text.text = "Health: " + targetMortal.CurrentHealth + "/" + targetMortal.MaxHealth;
     }
 }
Exemplo n.º 4
0
    void Update()
    {
        spin_angle += angular_velocity * Time.deltaTime;
        mesh_renderer.transform.localRotation =
            Quaternion.AngleAxis(MathUtility.RadiansToDegrees(spin_angle),
                                 new Vector3(0, 0, 1));

        Vector3 displacement = transform.position - last_position;

        RaycastHit[] raycast_hits = UnityEngine.Physics.RaycastAll(last_position, displacement.normalized, displacement.magnitude);

        foreach (RaycastHit raycast_hit in raycast_hits)
        {
            if (raycast_hit.collider.gameObject == Source.gameObject)
            {
                continue;
            }

            if (raycast_hit.collider.gameObject.HasComponent <Mortal>())
            {
                Mortal   mortal   = raycast_hit.collider.gameObject.GetComponent <Mortal>();
                Physical physical = mortal.GetComponent <Physical>();

                float angle = (mortal.transform.position - raycast_hit.point).AngleBetween(displacement);
                float intersection_length = Mathf.Min(mortal.transform.localScale.y / Mathf.Cos(angle),
                                                      raycast_hit.point.Distance(transform.position));

                float energy_imparted = Physical.KineticEnergy * (1 - Mathf.Pow(Penetration, intersection_length));
                Physical.KineticEnergy -= energy_imparted;

                float damage_energy = 0;
                if (physical == null)
                {
                    damage_energy = energy_imparted;
                }
                else if (Physical.Velocity.magnitude > mortal.ImpactTolerance)
                {
                    damage_energy = energy_imparted * mortal.ImpactFragility;
                }

                float kinetic_energy = energy_imparted - damage_energy;

                if (kinetic_energy > 0)
                {
                    physical.Velocity += Physical.Velocity.normalized *
                                         Measures.MetersToWorldUnits(Mathf.Sqrt(2 * kinetic_energy / physical.Mass));
                }

                mortal.Health.Value -= BaseDamage * KineticEnergyToDamage(damage_energy);
            }
        }

        if (Scene.Main.World.Asteroid.GetSurfaceHeight(Physical.Position) > transform.position.y)
        {
            GameObject.Destroy(gameObject);
        }
    }
Exemplo n.º 5
0
 void Awake()
 {
     body        = transform.Find("Body");
     groundCheck = transform.Find("groundCheck");
     anim        = body.gameObject.GetComponent <Animator>();
     line        = GetComponent <LineRenderer>();
     ropeAttach  = transform.Find("RopeAttach").gameObject;
     getBackRope = transform.Find("GetBackRope").gameObject;
     rope        = GetComponent <SpringJoint2D>();
     health      = GetComponent <Mortal>();
     collider    = GetComponent <BoxCollider2D>();
 }
Exemplo n.º 6
0
    void doDamage(GameObject otherObject)
    {
        Mortal m = otherObject.GetComponent <Mortal>();

        if (m != null)
        {
            if (m.Damage(gameObject.tag, amount))
            {
                onKill.Invoke();
            }
        }
    }
Exemplo n.º 7
0
 void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject.CompareTag("Destroyable"))
     {                   // Объект, в который врезались, уничтожаемый?
         Mortal HP = collision.gameObject.GetComponent <Mortal>();
         HP.lowerHP((int)(attackPower * attackFactor));
     }
     if (!collision.gameObject.CompareTag("Spell"))
     {
         Object.Destroy(gameObject);
     }
 }
Exemplo n.º 8
0
    public void OnHealthChange(Mortal health, float oldValue)
    {
        if (health.CurrentHealth < oldValue)
        {
            // Choose a random, but different taunt.
            ouchIndex = OuchRandom();

            // Play the new taunt.
            GetComponent <AudioSource>().clip = ouch[ouchIndex];
            GetComponent <AudioSource>().Play();
        }
    }
Exemplo n.º 9
0
    void Awake()
    {
        // Setting up references.
        body         = transform.Find("Body");
        groundCheck1 = transform.Find("groundCheck1");
        groundCheck2 = transform.Find("groundCheck2");
        groundCheck3 = transform.Find("groundCheck3");
        anim         = body.GetComponent <Animator>();
        health       = GetComponent <Mortal>();

        jumpBeacon = (GameObject)Resources.Load("Prefabs/JumpBeacon");
    }
Exemplo n.º 10
0
    public void CharacterPanelInit(PawnInstance _pawnInstanceForInit)
    {
        int initIndex = 0;

        for (int i = 0; i < 3; i++)
        {
            if (_pawnInstanceForInit.GetComponent <Prisoner>())
            {
                initIndex = 2;
                break;
            }
            if (occupiedCharacterPanelIndex[i] == false)
            {
                initIndex = i;
                break;
            }
        }

        Transform characterPanel = charactersPanel.transform.GetChild(initIndex).GetChild(0);

        characterPanel.GetChild((int)CharactersPanelChildren.Avatar).GetChild(0).GetComponent <Image>().sprite = _pawnInstanceForInit.Data.AssociatedSpriteForBattle;

        Mortal mortalComponent = _pawnInstanceForInit.GetComponent <Mortal>();
        Image  lifeBarImg      = characterPanel.GetChild((int)CharactersPanelChildren.LifeBar).GetChild((int)LifeBarChildren.Remaining).GetComponent <Image>();

        lifeBarImg.fillAmount = mortalComponent.CurrentHp / (float)mortalComponent.Data.MaxHp;
        lifeBarImg.sprite     = GameManager.Instance.SpriteUtils.spritePlayerGreenLifeBar;

        if (lifeBarImg.fillAmount < 0.33f)
        {
            lifeBarImg.color = Color.red;
        }
        else
        {
            lifeBarImg.color = Color.green;
        }
        characterPanel.GetChild((int)CharactersPanelChildren.LifeBar).GetChild((int)LifeBarChildren.Text).GetComponent <Text>().text = mortalComponent.CurrentHp + " / " + mortalComponent.Data.MaxHp;

        Fighter fighterComponent = _pawnInstanceForInit.GetComponent <Fighter>();

        characterPanel.GetChild((int)CharactersPanelChildren.Attributes).GetChild((int)AttributesChildren.Attack).GetComponentInChildren <Text>().text  = fighterComponent.PhysicalSymbolStored.ToString();
        characterPanel.GetChild((int)CharactersPanelChildren.Attributes).GetChild((int)AttributesChildren.Defense).GetComponentInChildren <Text>().text = fighterComponent.DefensiveSymbolStored.ToString();
        characterPanel.GetChild((int)CharactersPanelChildren.Attributes).GetChild((int)AttributesChildren.Magic).GetComponentInChildren <Text>().text   = fighterComponent.MagicalSymbolStored.ToString();

        occupiedCharacterPanelIndex[initIndex] = true;
        characterPanel.gameObject.SetActive(true);
        associatedCharacterPanel.Add(_pawnInstanceForInit, characterPanel);
        associatedCharacterPanelReversed.Add(characterPanel, _pawnInstanceForInit);
        SkillsPanelInit(_pawnInstanceForInit, initIndex);
    }
Exemplo n.º 11
0
 void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject.name != "WaterSplash(Clone)")
     {
         if (collision.gameObject.CompareTag("Destroyable"))
         {   // Объект, в который врезались, уничтожаемый?
             Mortal HP = collision.gameObject.GetComponent <Mortal>();
             HP.lowerHP(attackPower);
         }
         else
         {
             Object.Destroy(gameObject);
         }
     }
 }
Exemplo n.º 12
0
    void FixedUpdate()
    {
        rb.AddForce(transform.forward * 1.5f);

        Collider[] intersectObjs = Physics.OverlapSphere(transform.position, 0.25f);
        if (intersectObjs.Length != 0)
        {
            if (intersectObjs [0].CompareTag("Destroyable"))                // Объект, в который врезались, уничтожаемый?
            {
                Mortal HP = intersectObjs[0].GetComponent <Mortal>();
                HP.lowerHP(attackPower);
            }
            Object.Destroy(gameObject);
        }
    }
Exemplo n.º 13
0
    public void UpdateCharacterLifeBar(Mortal _toUpdate)
    {
        Transform panelToUpdate = associatedCharacterPanel[_toUpdate.GetComponent <PawnInstance>()];
        Image     lifeBarImg    = panelToUpdate.GetChild((int)CharactersPanelChildren.LifeBar).GetChild((int)LifeBarChildren.Remaining).GetComponent <Image>();

        lifeBarImg.fillAmount = _toUpdate.CurrentHp / (float)_toUpdate.Data.MaxHp;
        lifeBarImg.sprite     = GameManager.Instance.SpriteUtils.spritePlayerGreenLifeBar;

        if (lifeBarImg.fillAmount < 0.33f)
        {
            lifeBarImg.color = Color.red;
        }
        else
        {
            lifeBarImg.color = Color.green;
        }
        panelToUpdate.GetChild((int)CharactersPanelChildren.LifeBar).GetChild((int)LifeBarChildren.Text).GetComponent <Text>().text = _toUpdate.CurrentHp + " / " + _toUpdate.Data.MaxHp;
    }
Exemplo n.º 14
0
 protected void Attack(Mortal target)
 {
     EngageRaycast();
     occupied = true;
     if (canAtk && target != null)
     {
         target.takeDamage(atk);
         if (alignment == faction.ai)
         {
             _soundEffects.enemyAttackSound();
         }
         else
         {
             _soundEffects.allyAttackSound();
         }
         StartCoroutine(StartAtkCoolDown());
     }
 }
Exemplo n.º 15
0
 void Start()
 {
     RaycastHit2D[] results = Physics2D.CircleCastAll(transform.position, EXPLOSION_RADIUS, Vector2.zero, 0);
     foreach (RaycastHit2D result in results)
     {
         Flammable flammable = result.collider.gameObject.GetComponent <Flammable>();
         if (flammable)
         {
             flammable.SetOnFire();
         }
         Mortal mortal = result.collider.gameObject.GetComponent <Mortal>();
         if (mortal)
         {
             mortal.Damage(gameObject.tag, EXPLOSION_DAMAGE);
         }
     }
     Camera.main.gameObject.GetComponent <CameraHelper>().Shake();
     SoundManager.Play(explosionSound);
 }
Exemplo n.º 16
0
 void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject == owner)          // TODO
     {
         isghost       = false;
         rend.material = activatedPhantasmMaterial;
     }
     else if (isghost)
     {
     }
     else if (collision.gameObject.CompareTag("Destroyable"))
     {         // Объект, в который врезались, уничтожаемый?
         Mortal HP = collision.GetComponent <Mortal>();
         HP.lowerHP((int)(attackFactor * attackPower));
     }
     else if (collision.gameObject.tag != "Spell")
     {
         Object.Destroy(gameObject);
     }
 }
Exemplo n.º 17
0
Arquivo: Car.cs Projeto: xiabob/ld46
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (IsMoving() && body.velocity.sqrMagnitude > CRASH_SPEED_THRESHOLD)
     {
         SpriteSquish spriteSquish = collision.gameObject.GetComponent <SpriteSquish>();
         if (spriteSquish)
         {
             spriteSquish.SquishThin();
         }
         Flammable flammable = collision.gameObject.GetComponentInChildren <Flammable>();
         if (flammable)
         {
             this.flammable.SetOnFire();
             flammable.SetOnFire();
         }
         Mortal mortal = collision.gameObject.GetComponent <Mortal>();
         if (mortal)
         {
             mortal.Damage(gameObject.tag, CAR_CRASH_DAMAGE);
         }
     }
 }
Exemplo n.º 18
0
    public void UpdateLifeBar(Mortal _toUpdate)
    {
        foreach (Transform child in _toUpdate.transform)
        {
            if (child.CompareTag("FeedbackTransform"))
            {
                GameObject lifeBar    = child.GetChild(0).GetChild(1).gameObject;
                Image      lifeBarImg = lifeBar.transform.GetChild((int)LifeBarChildren.Remaining).GetComponent <Image>();
                lifeBarImg.fillAmount = _toUpdate.CurrentHp / (float)_toUpdate.MaxHp;
                lifeBarImg.sprite     = GameManager.Instance.SpriteUtils.spriteMonsterGreenLifeBar;

                if (lifeBarImg.fillAmount < 0.33f)
                {
                    lifeBarImg.color = Color.red;
                }
                else
                {
                    lifeBarImg.color = Color.green;
                }
                break;
            }
        }
    }
Exemplo n.º 19
0
 public void OnDamageHandler(Mortal mortal, int amount, int currentHealth)
 {
     minusSystem.Play();
     _minusTimer = Time.time;
 }
Exemplo n.º 20
0
 void Awake()
 {
     aging = GetComponent<Age>();
     breeding = GetComponent<Breeding>();
     mortal = GetComponent<Mortal>();
 }
Exemplo n.º 21
0
        public EditMortal(MainWindow parent, int whichMortal)
        {
            mortal = new Mortal();

            InitializeComponent();

            this.whichMortal = whichMortal;
            this.parent      = parent;

            if (whichMortal < 0)
            {
                mortal = new Mortal();
            }
            else
            {
                mortal             = (Mortal)parent.City.Characters[whichMortal];
                mortalWindow.Title = mortal.Name;
            }

            nameField.Text = mortal.Name;
            nameField.Focus();
            nameField.SelectAll();

            maskField.Text = mortal.Mask;

            playerField.Text   = mortal.Player;
            dirgeField.Text    = mortal.Dirge;
            humanityDots.Value = mortal.Humanity.Dots;

            conceptField.Text   = mortal.Concept;
            biographyField.Text = mortal.Biography;

            intelligenceDots.Value = mortal.Attributes[(int)Intelligence].Dots;
            witsDots.Value         = mortal.Attributes[(int)Wits].Dots;
            resolveDots.Value      = mortal.Attributes[(int)Resolve].Dots;

            strengthDots.Value  = mortal.Attributes[(int)Strength].Dots;
            dexterityDots.Value = mortal.Attributes[(int)Dexterity].Dots;
            staminaDots.Value   = mortal.Attributes[(int)Stamina].Dots;

            presenceDots.Value     = mortal.Attributes[(int)Presence].Dots;
            manipulationDots.Value = mortal.Attributes[(int)Manipulation].Dots;
            composureDots.Value    = mortal.Attributes[(int)Composure].Dots;

            academicsDots.Value     = mortal.Skills[(int)Academics].Dots;
            computerDots.Value      = mortal.Skills[(int)Computer].Dots;
            craftsDots.Value        = mortal.Skills[(int)Crafts].Dots;
            investigationDots.Value = mortal.Skills[(int)Investigation].Dots;
            medicineDots.Value      = mortal.Skills[(int)Medicine].Dots;
            occultDots.Value        = mortal.Skills[(int)Occult].Dots;
            politicsDots.Value      = mortal.Skills[(int)Politics].Dots;
            scienceDots.Value       = mortal.Skills[(int)Science].Dots;

            athleticsDots.Value = mortal.Skills[(int)Athletics].Dots;
            brawlDots.Value     = mortal.Skills[(int)Brawl].Dots;
            driveDots.Value     = mortal.Skills[(int)Drive].Dots;
            firearmsDots.Value  = mortal.Skills[(int)Firearms].Dots;
            larcenyDots.Value   = mortal.Skills[(int)Larceny].Dots;
            stealthDots.Value   = mortal.Skills[(int)Stealth].Dots;
            survivalDots.Value  = mortal.Skills[(int)Survival].Dots;
            weaponryDots.Value  = mortal.Skills[(int)Weaponry].Dots;

            animalKenDots.Value    = mortal.Skills[(int)AnimalKen].Dots;
            empathyDots.Value      = mortal.Skills[(int)Empathy].Dots;
            expressionDots.Value   = mortal.Skills[(int)Expression].Dots;
            intimidationDots.Value = mortal.Skills[(int)Intimidation].Dots;
            persuasionDots.Value   = mortal.Skills[(int)Persuasion].Dots;
            socializeDots.Value    = mortal.Skills[(int)Socialize].Dots;
            streetwiseDots.Value   = mortal.Skills[(int)Streetwise].Dots;
            subterfugeDots.Value   = mortal.Skills[(int)Subterfuge].Dots;
        }
Exemplo n.º 22
0
 public void Init()
 {
     victim = thirdPersonMovement.GetComponent <Mortal>();
 }
Exemplo n.º 23
0
 // Use this for initialization
 void Start()
 {
     deathAction = GetComponent <Mortal> ();
 }
Exemplo n.º 24
0
 public override void OnEquipped(Mortal equipper)
 {
     equipper.GetStat("Def").PercentModifiers.Add(defenseMod);
 }
Exemplo n.º 25
0
    SkillBattle DuckySkillDecisionAlgo(Fighter _fighter)
    {
        List <SkillBattle> skills = _fighter.BattleSkills;
        Mortal             mortal = _fighter.GetComponent <Mortal>();

        // si CurrentHp < 20%
        if (mortal.CurrentHp < mortal.Data.MaxHp / 5.0f)
        {
            if (!arrivedInNewTierThisTurn)
            {
                arrivedInNewTierThisTurn = true;
                return(skills[(int)DuckySkills.StrongCoin]);
            }

            return(skills[(int)DuckySkills.CoinCoin]);
        }
        else if (mortal.CurrentHp < mortal.Data.MaxHp / 2.5f)
        {
            if (BattleHandler.NbTurn % 5 == 1)
            {
                return(skills[(int)DuckySkills.StrongCoin]);
            }

            if (Random.Range(0, 10) > 4)
            {
                return(skills[(int)DuckySkills.CoinCoin]);
            }
            return(skills[(int)DuckySkills.NormalCoin]);
        }
        else if (mortal.CurrentHp < mortal.Data.MaxHp / 1.25f)
        {
            if (BattleHandler.NbTurn % 5 == 1)
            {
                return(skills[(int)DuckySkills.StrongCoin]);
            }

            if (BattleHandler.NbTurn % 2 == 0)
            {
                return(skills[(int)DuckySkills.WeakCoin]);
            }
            else
            {
                if (Random.Range(0, 10) > 6)
                {
                    return(skills[(int)DuckySkills.CoinCoin]);
                }
                return(skills[(int)DuckySkills.NormalCoin]);
            }
        }
        else
        {
            if (BattleHandler.NbTurn % 3 != 0)
            {
                return(skills[(int)DuckySkills.WeakCoin]);
            }
            else
            {
                if (Random.Range(0, 10) > 7)
                {
                    return(skills[(int)DuckySkills.CoinCoin]);
                }
                return(skills[(int)DuckySkills.NormalCoin]);
            }
        }
    }
Exemplo n.º 26
0
 private void waiting(Mortal target, out float direction, out bool jump)
 {
     direction = 0;
     jump = false;
 }
Exemplo n.º 27
0
 private void attacking(Mortal target, out float direction, out bool jump)
 {
     direction = target.transform.position.z - transform.position.z;
     jump = true;
 }
Exemplo n.º 28
0
 public void OnHealHandler(Mortal mortal, int amount, int currentHealth)
 {
     plusSystem.Play();
     _plusTimer = Time.time;
 }
Exemplo n.º 29
0
 public override void OnUnequipped(Mortal unequipper)
 {
     unequipper.GetStat("Def").PercentModifiers.Remove(defenseMod);
 }
Exemplo n.º 30
0
 public void OnDeathHandler(Mortal mortal)
 {
     _text.text = "Dead";
 }
Exemplo n.º 31
0
 // Start is called before the first frame update
 void OnEnable()
 {
     _mortal           = GetComponent <Mortal>();
     _mortal.onHit    += HealthUpdate;
     _mortal.onHealed += HealthUpdate;
 }
Exemplo n.º 32
0
 public override void OnUnequipped(Mortal unequipper)
 {
     // nothing special
 }
Exemplo n.º 33
0
 public void OnHealHandler(Mortal mortal, int amount, int currenthealth)
 {
     _text.text = "Health: " + mortal.CurrentHealth + "/" + mortal.MaxHealth;
 }