public void Play_Pokemon_Anim(Animator anim, Player_Action atk = null)
    {
        if (atk == null)
        {
            anim.Play(anim.runtimeAnimatorController.animationClips[0].name);
        }
        else
        {
            AnimationClip toPlay = null;
            foreach (AnimationClip clip in anim.runtimeAnimatorController.animationClips)
            {
                if (clip.name.Contains(atk.name))
                {
                    toPlay = clip;
                    break;
                }
            }
            if (toPlay == null)
            {
                return;
            }

            anim.Play(toPlay.name);
        }
    }
 void Start()
 {
     game_manager    = GameManager.Instance;
     dungeon_manager = Dungeon_Manager.Instance;
     player_action   = Player_Manager.Instance.player_action;
     dungeon_data    = new Dungeon_Data();
     enemy_status    = new Enemy_Status();
 }
Example #3
0
 void Start()
 {
     player             = Player_Manager.Instance.player;
     player_script      = Player_Manager.Instance.player_script;
     player_action      = Player_Manager.Instance.player_action;
     player_status      = Player_Manager.Instance.player_status;
     map_layer          = Dungeon_Manager.Instance.map_layer_2D;
     damage_calculation = new Damage_Calculation();
 }
 void Awake()
 {
     player        = GameObject.Find("Player");
     player_script = player.GetComponent <Player>();
     player_move   = gameObject.AddComponent <Player_Move>();
     player_status = new Player_Status();
     player_status.Initialize();
     player_action = gameObject.AddComponent <Player_Action>();
     action_stair  = gameObject.AddComponent <Action_On_Stair>();
 }
Example #5
0
 public void AddItemToInventory(Player_Action item)
 {
     if (this.PokeList.Count >= 4)
     {
         //TODO: Show message saying inventory is full
         Debug.Log("INVENTORY IS FULL!");
     }
     else
     {
         this.Inventory.AddLast(item);
     }
 }
 public void doAction(Player_Action action, out BattleStates newState)
 {
     if (action.GetType() == typeof(Header_Option))
     {
         updateUI_State((Header_Option)action);
         newState = BattleStates.PLAYER;
     }
     else
     {
         action.execute(player: this.StartingPlayer.Current_Pokemon, enemy: this.enemy, this.StartingPlayer.PokeList);
         this.StartingPlayer.Current_Pokemon.chosenAction = action;
         newState = BattleStates.PLAYER_ANIMATION;
     }
 }
    /*
     * Setup_UI_Elements(void) : void
     *
     * This sets up the initial UI elements.
     *
     * Return : void
     */
    private void Setup_UI_Elements()
    {
        Player_Action[] inv = new Player_Action[StartingPlayer.Inventory.Count];
        StartingPlayer.Inventory.CopyTo(inv, 0); //Copy linked list into array

        Header_Option attacks = new Header_Option("Attacks", StartingPlayer.Current_Pokemon.moveSet);
        Header_Option bag     = new Header_Option("Bag", inv);
        Header_Option pokemon = new Header_Option("Pokemon", UI_Util.PokeListToAction(this.StartingPlayer));
        Header_Option flee    = new Header_Option("Flee");

        this.UI_State = new Player_Action[, ] {
            { attacks, bag }, { pokemon, flee }
        };                                                                            // This will always be the initial state
        this.UI_InitialState = new Player_Action[, ] {
            { attacks, bag }, { pokemon, flee }
        };                                                                                   // This serves as a COPY of the initial state;
    }
    private Player_Action[,] getNewState(Player_Action[] subList)
    {
        //Lets make a N X 2 matrix, where is N is the 'sublist.Length / 2', and lets fill that matrix with every value of our sublist:
        Player_Action[,] rtnState = new Player_Action[subList.Length / 2, 2];

        int subList_idx = 0;

        while (subList_idx < subList.Length)
        {
            int row = subList_idx / 2; // For i to N: row = 0, 0, 1, 1, 2, 2, ...., n-1, n-1, n, n -- this value is floored each time allowing us to make this pattern
            int col = subList_idx % 2; // For i to N: col = 0, 1, 0, 1, 0 , 1,...., 0, 1, 0, 1 -- taking the mod allows us to alternate between column 1 and 2.

            rtnState[row, col] = subList[subList_idx];
            subList_idx++;
        }
        return(rtnState);
    }
Example #9
0
        public Pokemon(int slotNumber, string name, Tuple <PokeType, PokeType> TypeAndWeakness, Attack[] moveSet, Player_Action chosenAction = null)
        {
            this.slotNumber       = slotNumber;
            this.name             = name;
            this.pokemonType      = TypeAndWeakness.Item1;
            this.weaknessPokeType = TypeAndWeakness.Item2;

            this.currentConditions = new LinkedList <Condition>();
            this.canAttack         = true;        // If FROZEN or STUNNED, this pokemon cannot attack
            this.isConfused        = false;       // If this is set to true, theres a 50% chance that this Pokemon will attack itself
            this.damageModifier    = 0.0f;        // This is a value that ranges from -0.5 -- 0.5. It takes a proportion of , and adds that to the outgoing damage

            this.stats        = getRandomStats(); // TODO: Make a base stats table in SQLite
            this.moveSet      = moveSet;
            this.chosenAction = chosenAction;
        }
Example #10
0
 public void RemoveItemFromInventory(Player_Action item)
 {
     this.Inventory.Remove(item);
 }
 void Start()
 {
     player_script = Player_Manager.Instance.player_script;
     player_action = Player_Manager.Instance.player_action;
     action_stair  = Player_Manager.Instance.action_stair;
 }