Exemplo n.º 1
0
 void ChangeControl()
 {
     if (GameObject.FindGameObjectWithTag("Player").GetComponent<Battler>())
     {
         inControl = GameObject.FindGameObjectWithTag("Player").GetComponent<Battler>();
     }
 }
Exemplo n.º 2
0
 public TrumpBehavior(Battler parent)
 {
     WallPrefab = Resources.Load<GameObject>("Wall");
     CombPrefab = Resources.Load<GameObject>("Comb");
     Battler = parent;
     anim = parent.gameObject.GetComponent<Animator>();
 }
Exemplo n.º 3
0
 public void RemoveFromInventory(Battler user)
 {
     Quantity--;
     if (Quantity <= 0)
     {
         user.Inventory.Remove(this);
     }
 }
Exemplo n.º 4
0
 //Only burn is implemented
 void BurnStatus(Battler battler)
 {
     if (battler == Character)
     {
         statusText.text = "Burn";
         statusText.color = new Color(1f, 0.25f, 0f);
     }
 }
Exemplo n.º 5
0
 public override void TakeDamage(Battler user, int baseDamage)
 {
     base.TakeDamage(user, baseDamage);
     if (!defending)
     {
         Battler.StartCoroutine(Anim());
     }
 }
Exemplo n.º 6
0
 //Implement a BattleBehavior.UseSP function
 public void UseSP(Battler user)
 {
     user.BattleBehavior.Stats.CurrentSP -= RequiredSP;
     if (user.BattleBehavior.Stats.CurrentSP < 0)
     {
         user.BattleBehavior.Stats.CurrentSP = 0;
     }
     user.BattleBehavior.SPEvent(user.BattleBehavior.Stats.CurrentSP, user.BattleBehavior.Stats.MaxSP);
 }
Exemplo n.º 7
0
    private void SpawnBattler(int _prefabIndex, BattlerPosition _pos, Battler.Alliance _alliance)
    {
        GameObject spawn = MasterDatabase.MasterData.battlerPrefabs[_prefabIndex];

        GameObject.Instantiate(spawn);
        //spawn.GetComponent<Battler>().position = _pos;
        //spawn.GetComponent<Battler>().alliance = _alliance;
        //spawn.name = "Battler " + numberOfBattlers.ToString();
        numberOfBattlers++;
    }
Exemplo n.º 8
0
 public override IEnumerator StandardAttack(Battler user, Battler target)
 {
     Animator anim = user.GetComponent<Animator>();
     Vector3 startPos = user.gameObject.transform.position;
     anim.SetInteger("State", 1);
     yield return Move.MoveInFrontOfBattler(user, target, startPos, new Vector3(-2f, 0f, 0f), 50);
     anim.SetInteger("State", 2);
     int baseDamage = (user.BattleBehavior.Stats.Attack * 6) - (target.BattleBehavior.Stats.Defense * 3);
     baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     yield return new WaitForSeconds(0.5f);
     target.BattleBehavior.TakeDamage(user, baseDamage);
     yield return new WaitForSeconds(0.3f);
     anim.SetInteger("State", 1);
     yield return Move.MoveBackFromBattler(user, target, startPos, new Vector3(-2f, 0f, 0f), 50);
     anim.SetInteger("State", 0);
 }
Exemplo n.º 9
0
 public static IEnumerator MoveInFrontOfBattler(Battler user, Battler target, Vector3 startPos, Vector3 offset, int duration)
 {
     Quaternion startRotation = user.transform.rotation;
     Vector3 targetPos = target.gameObject.transform.position + offset;
     targetPos.y = startPos.y;
     var heading = targetPos - startPos;
     var distance = heading.magnitude;
     var direction = heading / distance;
     user.transform.rotation = Quaternion.LookRotation(direction);
     for (int i = 0; i < duration; i++)
     {
         Vector3 newPos = startPos + (targetPos - startPos) * (float)i / duration;
         user.gameObject.transform.position = newPos;
         yield return 0;
     }
     user.transform.rotation = startRotation;
     user.transform.position = targetPos;
 }
Exemplo n.º 10
0
 void HPText(Battler battler, int dHealth)
 {
     
     Vector3 position = Camera.main.WorldToScreenPoint(battler.gameObject.transform.position);
     position.y += 30f;
     GameObject num = Instantiate(DamageNumberPrefab) as GameObject;
     num.transform.SetParent(Canvas.transform);
     num.transform.position = position;
     DamageNumber dn = num.GetComponent<DamageNumber>();
     dn.Damage = Mathf.Abs(dHealth);
     if (dHealth > 0)
     {
         dn.Color = Color.green;
     }
 }
Exemplo n.º 11
0
    public virtual void Use(Battler user, Battler recipient)
    {

    }
Exemplo n.º 12
0
 void BurnText(Battler battler)
 {
     Vector3 position = Camera.main.WorldToScreenPoint(battler.gameObject.transform.position);
     position.x += 90f;
     position.y += 30f;
     GameObject text = Instantiate(BurnTextPrefab) as GameObject;
     text.transform.SetParent(Canvas.transform);
     text.transform.position = position;
 }
Exemplo n.º 13
0
 void CreateStar(Battler user, Battler target)
 {
     float hue = Random.Range(0f, 1f);
     Color color = Color.HSVToRGB(hue, 1f, 1f);
     color *= 1.1f;
     Vector3 starPos = user.gameObject.transform.position;
     starPos.x -= 20f;
     starPos.y = 20f;
     starPos.z += Random.Range(-20f, 20f);
     Vector3 targetPos = target.gameObject.transform.position;
     targetPos.z = starPos.z;
     Quaternion angle = Quaternion.Euler(0f, 180f, 0f);
     GameObject star = Instantiate(StarPrefab, starPos, angle) as GameObject;
     Material starMaterial = star.GetComponent<MeshRenderer>().material;
     //Changes color to blue
     starMaterial.SetColor("_EmissionColor", color);//new Color(0f, 0f, 1.2f));
     Rigidbody rb = star.GetComponent<Rigidbody>();
     var heading = targetPos - starPos;
     var distance = heading.magnitude;
     var direction = heading / distance;
     rb.AddForce(direction * 1500f);
     Destroy(star, 5f);
 }
Exemplo n.º 14
0
 public override IEnumerator Run(Battler user, Battler target, IList<Battler> allCharacters, IList<Battler> allEnemies, BattleController battlecontroller)
 {
     Animator anim = user.gameObject.GetComponent<Animator>();
     BattleBehavior.Battler.StartCoroutine(SpecialEffectsManager.SpecialName(Name));
     Vector3 startPos = allCharacters[0].gameObject.transform.position;
     startPos.y = 2f;
     startPos.z = 10f;
     anim.SetInteger("State", 3);
     yield return new WaitForSeconds(2f);
     Instantiate(CombPrefab, startPos, Quaternion.identity);
     yield return new WaitForSeconds(2.4f);
     IList<Battler> liveCharacters = allCharacters.Where(c => c.BattleBehavior.Status.StatusEffect != StatusEffect.Defeated).ToList();
     foreach (Battler c in liveCharacters)
     {
         int baseDamage = (int)(user.BattleBehavior.Stats.SpAttack * Power * 6) - (c.BattleBehavior.Stats.SpDefense * 3);
         if (baseDamage > 0)
             baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
         else
             baseDamage = 0;
         c.BattleBehavior.TakeDamage(user, baseDamage);
     }
     anim.SetInteger("State", 0);
 }
Exemplo n.º 15
0
 public SteveBehavior(Battler parent)
 {
     Battler = parent;
 }
Exemplo n.º 16
0
 public static void DeathParticles2(Battler battler)
 {
     Vector3 pos = battler.gameObject.transform.position;
     pos.y = 0f;
     GameObject deathParticles = MonoBehaviour.Instantiate(DeathParticlesPrefab2, pos, Quaternion.identity) as GameObject;
     MonoBehaviour.Destroy(deathParticles, 3f);
 }
Exemplo n.º 17
0
 void MoveCursor(Battler character)
 {
     Renderer r = character.gameObject.GetComponentInChildren<Renderer>();
     CharacterCursor.transform.localPosition = character.gameObject.transform.position + new Vector3(0f, r.bounds.size.y + 1.5f + cursorY - character.gameObject.transform.position.y, 0f);
 }
Exemplo n.º 18
0
    public void CharacterTurn(Battler character)
    {
        //Only attack enemies that are alive
        allEnemies = allEnemies.Where(e => e.BattleBehavior.Status.StatusEffect != StatusEffect.Defeated).ToList();

        onTurn = true;
        cursorHover = false;
        gameObject.SetActive(true);
        currentCharacter = character;
        mainIndex = 0;
        specialIndex = 0;
        itemIndex = 0;
        charIndex = 0;
        enemyIndex = 0;
        MainMenu();
        UpdateMenu();
        UpdateCharacterName();
        Vector3 circlePos = currentCharacter.transform.position;
        circlePos.y = 0.25f;
        MagicCircle.transform.position = circlePos;//= currentCharacter.transform.position + new Vector3(0f, -2f, 0f);
        StartCoroutine(SpinCircle());
        StartCoroutine(CursorHover());
    }
Exemplo n.º 19
0
 public CainaBehavior(Battler parent)
 {
     Battler = parent;
 }
Exemplo n.º 20
0
 public override IEnumerator Run(Battler user, Battler target, IList<Battler> allCharacters, IList<Battler> allEnemies, BattleController bc)
 {
     anim = user.GetComponent<Animator>();
     anim.SetInteger("State", 3);
     yield return new WaitForSeconds(1.4f);
     Camera.main.hdr = true;
     Light light = GameObject.FindGameObjectWithTag("Light").GetComponent<Light>();
     yield return new WaitForSeconds(0.3f);
     yield return Dim();
     for (int i = 0; i < starCount; i++)
     {
         CreateStar(user, target);
         yield return new WaitForSeconds(0.1f);
     }
     yield return new WaitForSeconds(3f);
     int baseDamage = (int)((user.BattleBehavior.Stats.SpAttack * 6 * Power) - (target.BattleBehavior.Stats.SpDefense * 3));
     baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     target.BattleBehavior.TakeDamage(user, baseDamage);
     yield return Brighten();
     Camera.main.hdr = false;
     anim.SetInteger("State", 0);
 }
Exemplo n.º 21
0
 IEnumerator MakeWalls(Battler target)
 {
     int count = 15;
     for (int i = 0; i < count; i++)
     {
         Vector3 pos = target.gameObject.transform.position;
         pos.x = 20 - (i * 3);
         GameObject wall = Instantiate(WallPrefab, pos, Quaternion.identity) as GameObject;
         yield return new WaitForSeconds(0.07f);
     }
 }
Exemplo n.º 22
0
 public HyperRatBehavior(Battler parent)
 {
     Battler = parent;
     anim = parent.gameObject.GetComponent<Animator>();
 }
Exemplo n.º 23
0
 public override IEnumerator Run(Battler user, Battler target, IList<Battler> allCharacters, IList<Battler> allEnemies, BattleController bc)
 {
     BattleBehavior.Battler.StartCoroutine(SpecialEffectsManager.SpecialName(Name));
     Animator anim = user.gameObject.GetComponent<Animator>();
     anim.SetInteger("State", 3);
     yield return new WaitForSeconds(2f);
     bc.StartCoroutine(CameraShake());
     yield return MakeWalls(target);
     yield return new WaitForSeconds(0.75f);
     anim.SetInteger("State", 0);
     int baseDamage = (int)(user.BattleBehavior.Stats.SpAttack * Power * 6) - (target.BattleBehavior.Stats.SpDefense * 3);
     if (baseDamage > 0)
         baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     else
         baseDamage = 0;
     target.BattleBehavior.TakeDamage(user, baseDamage);
 }
Exemplo n.º 24
0
 public static void RestoreParticles(Battler battler)
 {
     Vector3 pos = battler.gameObject.transform.position;
     pos.y = 0f;
     GameObject restoreParticles = MonoBehaviour.Instantiate(RestoreParticlesPrefab, pos, Quaternion.Euler(270f, 0f, 0f)) as GameObject;
     MonoBehaviour.Destroy(restoreParticles, 3f);
 }
Exemplo n.º 25
0
 public override IEnumerator Run(Battler user, Battler target, IList<Battler> allCharacters, IList<Battler> allEnemies, BattleController battlecontroller)
 {
     Animator anim = user.gameObject.GetComponent<Animator>();
     BattleBehavior.Battler.StartCoroutine(SpecialEffectsManager.SpecialName(Name));
     anim.SetInteger("State", 3);
     yield return new WaitForSeconds(2f);
     SpecialEffectsManager.FireParticles(target);
     yield return new WaitForSeconds(1f);
     int baseDamage = (int)(user.BattleBehavior.Stats.SpAttack * Power * 6) - (target.BattleBehavior.Stats.SpDefense * 3);
     if (baseDamage > 0)
         baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     else
         baseDamage = 0;
     target.BattleBehavior.TakeDamage(user, baseDamage);
     //50% chance of inflicting a burn
     target.BattleBehavior.AddStatusEffect(user, StatusEffect.Burn, 0.5f);
     anim.SetInteger("State", 0);
 }
Exemplo n.º 26
0
    IEnumerator PerformAction(Battler user, ActionType ActionType, Action action, int actionIndex, Battler target, IList<Battler> allCharacters, IList<Battler> allEnemies)
    {
        switch (ActionType)
        {
            case ActionType.Attack:
                yield return user.BattleBehavior.StandardAttack(user, target);
                break;

            case ActionType.Special:
                action.UseSP(user);
                yield return action.Run(user, target, allCharacters, allEnemies, this);
                break;

            case ActionType.Item:
                user.Inventory[actionIndex].RemoveFromInventory(user);
                user.Inventory[actionIndex].Use(user, target);
                break;

            case ActionType.Defend:
                Shield shield = Shields[user.BattlerIndex];
                user.BattleBehavior.Defending = true;
                shield.StartCoroutine(shield.Enter());
                break;
        }
    }
Exemplo n.º 27
0
 public static IEnumerator DeathCircles(Battler battler)
 {
     int circleCount = 25;
     Vector3 circlePos = battler.gameObject.transform.position;
     circlePos.y = battler.GetComponentInChildren<Renderer>().bounds.center.y;
     for (int i = 0; i < circleCount; i++)
     {
         Vector3 dir = Random.insideUnitSphere;
         Quaternion facing = Quaternion.LookRotation(dir);
         MonoBehaviour.Instantiate(DeathCirclePrefab, circlePos, facing);
         yield return new WaitForSeconds(0.08f);
     }
 }
Exemplo n.º 28
0
 public override IEnumerator Run(Battler user, Battler target, IList<Battler> allCharacters, IList<Battler> allEnemies, BattleController bc)
 {
     BattleBehavior.Battler.StartCoroutine(SpecialEffectsManager.SpecialName(Name));
     Animator anim = user.gameObject.GetComponent<Animator>();
     anim.SetInteger("State", 1);
     Vector3 startPos = user.gameObject.transform.position;
     yield return Move.MoveInFrontOfBattler(user, target, startPos, new Vector3(2f, 0f, 0f), 30);
     anim.SetInteger("State", 2);
     int baseDamage = (int)(user.BattleBehavior.Stats.SpAttack * Power * 6) - (target.BattleBehavior.Stats.SpDefense * 3);
     if (baseDamage > 0)
         baseDamage = new System.Random().Next((int)(baseDamage * 0.9), (int)(baseDamage * 1.1));
     else
         baseDamage = 0;
     yield return new WaitForSeconds(0.5f);
     target.BattleBehavior.TakeDamage(user, baseDamage);
     yield return new WaitForSeconds(0.3f);
     anim.SetInteger("State", 1);
     yield return Move.MoveBackFromBattler(user, target, startPos, new Vector3(2f, 0f, 0f), 30);
     anim.SetInteger("State", 0);
 }
Exemplo n.º 29
0
        public override IEnumerator Run(Battler user, Battler target, IList<Battler> allCharacters, IList<Battler> allEnemies, BattleController bc)
        {
            Animator anim = user.GetComponent<Animator>();
            anim.SetInteger("State", 3);
            yield return new WaitForSeconds(1.4f);
            int duration = 40;
            Material m = target.GetComponentInChildren<Renderer>().material;
            m.EnableKeyword("_EMISSION");

            SpecialEffectsManager.RestoreParticles(target);
            for (int i = 0; i < duration; i++)
            {
                m.SetColor("_EmissionColor", Color.white * 0.6f * Mathf.Sin((float) i / duration * Mathf.PI));
                yield return 0;
            }
            target.BattleBehavior.RestoreHP(user, 250);
            anim.SetInteger("State", 0);
            Debug.Log(user.BattleBehavior.Name + " restored 250 HP to " + target.BattleBehavior.Name);
        }
Exemplo n.º 30
0
 public static void FireParticles(Battler battler)
 {
     Vector3 pos = battler.gameObject.transform.position;
     pos.y = 0f;
     GameObject fire = MonoBehaviour.Instantiate(FireParticlesPrefab, pos, Quaternion.Euler(-90f, 0f, 0f)) as GameObject;
     MonoBehaviour.Destroy(fire, 5f);
 }