Exemple #1
0
    public GameObject GenerateLunen(Lunen species, int level, SortMovesType moveSort = SortMovesType.HighestFirst)
    {
        sr                      = GetComponent <SetupRouter>();
        New1                    = Instantiate(sr.database.MonsterTemplate);
        NewMonster1             = New1.GetComponent <Monster>();
        NewMonster1.sr          = sr;
        NewMonster1.Level       = level;
        NewMonster1.SourceLunen = species;
        NewMonster1.TemplateToMonster(species);
        switch (moveSort)
        {
        default: break;

        case SortMovesType.LowestFirst:
            NewMonster1.GetPreviousMoves();
            NewMonster1.SortMoves(false);
            break;

        case SortMovesType.HighestFirst:
            NewMonster1.GetPreviousMoves();
            NewMonster1.SortMoves(true);
            break;
        }

        return(New1);
    }
Exemple #2
0
    public void Start()
    {
        if (sr == null)
        {
            sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
        }
        moveDetection = new MoveDetection();

        pLogic = GetComponent <PlayerLogic>();
        tLogic = GetComponent <TrainerLogic>();



        spriteRenderer = GetComponent <SpriteRenderer>();

        if (pLogic != null)
        {
            logicType = LogicType.Player;
            endMove   = pLogic.MoveEnd;
        }
        else if (tLogic != null)
        {
            logicType = LogicType.Trainer;
            endMove   = tLogic.MoveEnd;
        }
        else
        {
            logicType = LogicType.NPC;
            endMove   = MoveEndStub;
        }
        moveSpeedCurrent = moveSpeed;
    }
Exemple #3
0
 void Start()
 {
     if (sr == null)
     {
         sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
     }
     button = GetComponent <Button>();
 }
Exemple #4
0
    public static void SaveGameData(SetupRouter sr)
    {
        BinaryFormatter bf     = new BinaryFormatter();
        FileStream      stream = new FileStream(Application.persistentDataPath + "/GameData.sav", FileMode.Create);

        GameData data = new GameData(sr);

        bf.Serialize(stream, data);
        stream.Close();
    }
    void Awake()
    {
        GameObject main = GameObject.Find("BattleSetup");

        if (main != null)
        {
            sr = main.GetComponent <SetupRouter>();
        }
        image = GetComponent <Image>();
    }
Exemple #6
0
 private void Awake()
 {
     if (sr == null)
     {
         sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
     }
     button       = GetComponent <Button>();
     scs          = GetComponent <SpriteColorShift>();
     image        = GetComponent <Image>();
     defaultColor = image.color;
 }
    void Awake()
    {
        sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();

        UICollections = new List <UIPanelCollection>();
        foreach (GameObject go in UIObjects)
        {
            UICollections.Add(go.GetComponent <UIPanelCollection>());
        }

        SetState(UIState.Overworld);
    }
Exemple #8
0
    public GameData(SetupRouter sr)
    {
        PlayerTeam = new List <PlayerLunen>();
        //Debug.Log("Found " + sr.battleSetup.PlayerLunenTeam.Count + " Lunen!");
        foreach (GameObject monster in sr.battleSetup.PlayerLunenTeam)
        {
            PlayerTeam.Add(GeneratePlayerLunen(monster.GetComponent <Monster>(), sr));
        }
        StorageLunen = sr.storageSystem.StoredLunen;

        InventoryItems = new List <InventoryItem>();
        //Debug.Log("Found " + sr.inventory.listOfItems.Count + " Item" + (sr.inventory.listOfItems.Count == 1 ? "" : "s") + "!");
        for (int i = 0; i < sr.inventory.listOfItems.Count; i++)
        {
            Inventory.InventoryEntry currentItem = sr.inventory.listOfItems[i];
            InventoryItem            a           = new InventoryItem();
            a.itemIndex  = sr.database.ItemToIndex(currentItem.item);
            a.itemAmount = currentItem.amount;
            InventoryItems.Add(a);
        }

        SaveTriggers = new List <TriggerSet>();
        for (int i = 0; i < sr.database.GlobalStoryTriggerList.Count; i++)
        {
            TriggerSet set = new TriggerSet();
            set.setName = sr.database.GlobalStoryTriggerList[i].name;
            foreach (TriggerPart part in sr.database.GlobalStoryTriggerList[i].triggerParts)
            {
                TriggerSave save = new TriggerSave();
                save.triggerTITLE  = part.title;
                save.triggerType   = part.type;
                save.triggerBool   = part.triggerBool;
                save.triggerInt    = part.triggerInt;
                save.triggerFloat  = part.triggerFloat;
                save.triggerDouble = part.triggerDouble;
                save.triggerString = part.triggerString;
                set.triggerParts.Add(save);
            }
            SaveTriggers.Add(set);
        }

        GuidList        = sr.battleSetup.GuidList;
        positionX       = sr.playerLogic.transform.position.x;
        positionY       = sr.playerLogic.transform.position.y;
        currentScene    = sr.battleSetup.lastOverworld;
        facingDirection = (int)sr.playerLogic.move.lookDirection;
        gold            = sr.inventory.gold;

        respawnX         = sr.battleSetup.respawnLocation.x;
        respawnY         = sr.battleSetup.respawnLocation.y;
        respawnScene     = sr.battleSetup.respawnScene;
        respawnDirection = (int)sr.battleSetup.respawnDirection;
    }
Exemple #9
0
    public void Execute()
    {
        sr = MonsterUser.sr;
        sr.soundManager.PlaySoundEffect("ConfirmSelection");
        Director.Team actionTeam = MonsterUser.MonsterTeam;
        Director.Team targetTeam = Director.Team.PlayerTeam;
        if (actionTeam == Director.Team.PlayerTeam)
        {
            targetTeam = Director.Team.EnemyTeam;
        }
        sr.eventLog.AddEvent("Attack: " + MonsterUser.Nickname + " attacks with " + Name + " targetting one enemy");
        if (customEvent != null)
        {
            customEvent.Invoke();
        }
        foreach (ActionPart part in PartsOfAction)
        {
            switch (part.Target)
            {
            case MonsterAim.SingleOpponent:
                ExecutePerMonster(part, sr.canvasCollection.GetTargetMonster(actionTeam, targetTeam));
                break;

            case MonsterAim.AllOpponents:
                for (int i = 0; i < sr.director.GetLunenCountOut(targetTeam); i++)
                {
                    ExecutePerMonster(part, sr.director.GetMonsterOut(targetTeam, i));
                }
                break;

            case MonsterAim.AllAllies:
                for (int i = 0; i < sr.director.GetLunenCountOut(actionTeam); i++)
                {
                    ExecutePerMonster(part, sr.director.GetMonsterOut(actionTeam, i));
                }
                break;

            case MonsterAim.SingleAlly:
                ExecutePerMonster(part, sr.canvasCollection.GetTargetMonster(actionTeam, actionTeam));
                break;

            case MonsterAim.Self:
                ExecutePerMonster(part, MonsterUser);
                break;
            }
        }
        sr.database.SetTriggerValue("BattleVars/AnimationTime", TimePausePeriod);
        sr.database.SetTriggerValue("BattleVars/AttackLunenName", MonsterUser.Nickname);
        sr.database.SetTriggerValue("BattleVars/AttackLunenAction", name);
        sr.battleSetup.StartCutscene(sr.database.GetPackedCutscene("LunenAttack"));
        MonsterUser.EndTurn();
    }
Exemple #10
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject main = GameObject.Find("BattleSetup");

        gc = GetComponent <GuidComponent>();
        if (main != null)
        {
            sr = main.GetComponent <SetupRouter>();
            if (sr.battleSetup.GuidInList(gc.GetGuid()))
            {
                Destroy(gameObject);
            }
        }
    }
Exemple #11
0
 private void OnDrawGizmosSelected()
 {
     if (sr == null)
     {
         srObject = GameObject.Find("BattleSetup");
         if (srObject != null)
         {
             sr = srObject.GetComponent <SetupRouter>();
         }
     }
     animTime = 0;
     SetWalkAnimation();
     SetSprite();
 }
Exemple #12
0
    void GetImportantVariables()
    {
        if (sr == null)
        {
            sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
        }
        if (move == null)
        {
            move = GetComponent <Move>();
        }

        move.animationSet = animationSet;
        wanderCurrent     = SetNewWaitTime(wanderLow, wanderHigh);
    }
Exemple #13
0
    public static PlayerLunen GeneratePlayerLunen(Monster currentMonster, SetupRouter sr)
    {
        PlayerLunen a = new PlayerLunen();

        a.species       = sr.database.LunenToIndex(currentMonster.SourceLunen);
        a.nickname      = currentMonster.Nickname;
        a.level         = currentMonster.Level;
        a.exp           = currentMonster.Exp.x;
        a.currentHealth = currentMonster.Health.z;
        a.learnedMoves  = new List <int>();
        for (int j = 0; j < currentMonster.ActionSet.Count; j++)
        {
            a.learnedMoves.Add(sr.database.ActionToIndex(currentMonster.ActionSet[j]));
        }
        return(a);
    }
Exemple #14
0
    // Start is called before the first frame update
    void Awake()
    {
        rb2D = GetComponent <Rigidbody2D>();
        move = GetComponent <Move>();

        sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
        //transform.position = sr.battleSetup.lastSceneLocation;
        sr.playerLogic      = this;
        sr.cameraFollow.Sel = this.gameObject;

        int animChoose = (int)sr.database.GetTriggerValue("PlayerInfo/AnimSet");

        if (animChoose >= playerAnimSets.Count)
        {
            animChoose = 0;
        }
        move.animationSet = playerAnimSets[animChoose];
    }
    void GetImportantVariables()
    {
        GameObject main = GameObject.Find("BattleSetup");

        if (main != null)
        {
            sr = main.GetComponent <SetupRouter>();


            UpdateTeam();
        }
        if (move == null)
        {
            move = GetComponent <Move>();
        }

        move.animationSet = animationSet;
    }
Exemple #16
0
    public static AIDecision StartDecision(SetupRouter sr, Monster monster)
    {
        AIDecision decision = new AIDecision(0, 0, 0);

        switch (monster.level)
        {
        default:
            break;

        case AILevel.Random:
            int movePool = 4;
            if (monster.ActionSet.Count < movePool)
            {
                movePool = monster.ActionSet.Count;
            }
            decision.moveIndex        = GetRandomValue(movePool);
            decision.targetOtherIndex = GetRandomValue(sr.director.GetLunenCountOut(Director.Team.PlayerTeam));
            decision.targetSelfIndex  = GetRandomValue(sr.director.GetLunenCountOut(Director.Team.EnemyTeam));
            break;
        }
        return(decision);
    }
Exemple #17
0
    private void Awake()
    {
        #if UNITY_EDITOR // conditional compilation is not mandatory
        GameObject findBattle = GameObject.Find("BattleSetup");
        if (findBattle == null)
        {
            database.SetTriggerValue("DEBUGTRIGGERS/FallbackPath", SceneManager.GetActiveScene().path);
            database.SetTriggerValue("DEBUGTRIGGERS/FallbackX", transform.position.x);
            database.SetTriggerValue("DEBUGTRIGGERS/FallbackY", transform.position.y);
            database.SetTriggerValue("DEBUGTRIGGERS/FallbackZ", transform.position.z);
            SceneManager.LoadScene("_preload");
        }
        #endif

        GameObject main = GameObject.Find("BattleSetup");
        if (main == null)
        {
            return;
        }
        sr = main.GetComponent <SetupRouter>();
        sr.sceneAttributes = this;

        sr.saveSystemObject.isLoading = false;
        sr.canvasCollection.CloseState(CanvasCollection.UIState.SceneSwitch);

        if (spawnPlayer)
        {
            PreparePlayer();
        }

        if (sr.battleSetup.InCutscene)
        {
            if (sr.battleSetup.GetCurrentCutscenePart().cutPartType == CutPartType.ChangeScene)
            {
                sr.battleSetup.AdvanceCutscene();
            }
        }
    }
Exemple #18
0
 // Start is called before the first frame update
 void Awake()
 {
     sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
     sr.cameraFollow = this;
 }
Exemple #19
0
 private void Awake()
 {
     sr = GetComponent <SetupRouter>();
 }
Exemple #20
0
 void Start()
 {
     sr = GetComponent <SetupRouter>();
 }
 public void Awake()
 {
     sr = GetComponent <SetupRouter>();
     RetrieveSettings();
 }
 void Start()
 {
     sr   = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
     text = GetComponent <Text>();
 }
Exemple #23
0
 void Awake()
 {
     sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
 }