Jump to content
Unity Insider Forum

Warum geht mein Pokemon script nicht


Banenchen
 Share

Recommended Posts

Ich möchte type-Effectnis machen aber da steht,dass nicht alle zahlen ausgeben

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenuAttribute(fileName = "Pokemon", menuName = "Pokemon/Create new pokemon")]

public class PokemonBase : ScriptableObject
{
    [SerializeField] string name;

    [TextArea]
    [SerializeField] string description;

    [SerializeField] Sprite frontSprite;
    [SerializeField] Sprite backSprite;

    [SerializeField] PokemonType type1;
    [SerializeField] PokemonType type2;

    //basestats
    [SerializeField] int maxHp;
    [SerializeField] int attack;
    [SerializeField] int defens;
    [SerializeField] int spDefense;
    [SerializeField] int spAttack;
    [SerializeField] int speed;

    [SerializeField] List<LearnableMove> learnableMoves;


  

    public string Name
    {
        get { return name;}
    }
    public string Description
    {
        get { return description;}
    }
    public Sprite FrontSprite
    {
        get { return frontSprite;}
    }
    public Sprite BackSprite
    {
        get { return backSprite;}
    }
    public PokemonType Type1
    {
        get { return type1;}
    }
    public PokemonType Type2
    {
        get { return type2;}
    }
    public int MaxHp
    {
        get { return maxHp;}
    }
      public int Attack
    {
        get { return attack;}
    }
      public int Defens
    {
        get { return defens;}
    }
      public int SpDefense
    {
        get { return spDefense;}
    }
      public int SpAttack
    {
        get { return spAttack;}
    }
    public int Speed
    {
        get { return speed;}
    }
    public List<LearnableMove> LearnableMoves
    {
        get{return learnableMoves;}
    }
    

}

[System.Serializable]

public class LearnableMove
{
    [SerializeField] MoveBase moveBase;
    [SerializeField] int level;

    public MoveBase Base
    {
        get{ return moveBase;}
    }
    public int Level
    {
        get{ return level;}
    }

}

public enum PokemonType
{
    None,
    Normal,
    Feuer,
    Wasser,
    Elektro,
    Pflanze,
    Gift,
    Flug,
    Eis,
    Boden,
    Kampf,
    Psycho,
    Käfer,
    Stein,
    Geist,
    Drache,
    Fee
}

public class TypeChart
{

    public PokemonType attackType;
    public PokemonType defenseType;



    float[][] chart =
    {new float[] { 1f,  1f,   1f,  1f,  1f,  1f,  1f,  1f,  1f,  1f,  1f,  1f, 0.5f, 0f,  1f,  1f, 0.5f },

    new float[] { 1f, 0.5f, 0.5f, 1f,  2f,  2f,  1f,  1f,  1f,  1f,  1f,  2f, 0.5f, 1f, 0.5f, 1f,  2f },

    new float[] { 1f,  2f,  0.5f, 2f, 0.5f, 1f,  1f,  1f,  2f,  1f,  1f,  1f,  2f,  1f, 0.5f, 1f,  1f },

    new float[] { 1f,  1f,   2f, 0.5f,0.5f, 2f,  1f,  1f,  0f,  2f,  1f,  1f,  1f,  1f, 0.5f, 1f,  1f },

    new float[] { 1f, 0.5f,  2f,  2f, 0.5f, 1f,  1f, 0.5f, 2f, 0.5f, 1f, 0.5f, 2f,  1f, 0.5f, 1f, 0.5f },

    new float[] { 1f, 0.5f, 0.5f, 1f,  2f, 0.5f, 1f,  1f,  2f,  2f,  1f,  1f,  1f,  1f,  2f,  1f, 0.5f },

    
    };

    public float GetEffectiveness()
    {
        if(attackType == PokemonType.None || defenseType == PokemonType.None)
        {
            return 1;

            int row = (int)attackType -1;
            int col = (int)defenseType -1;

            return chart[row][col];
        }
    }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...