Пример #1
0
    void Start()
    {
        actionFileName = Path.Combine(Application.dataPath.Replace('/', Path.DirectorySeparatorChar), Path.Combine(Path.Combine("Dataset", "MSRAction3DSkeletonReal3D"), "a01_s01_e01_skeleton3D.txt"));
//		actionFileName = Application.dataPath+"/Dataset/MSRAction3DSkeletonReal3D/a01_s01_e01_skeleton3D.txt";

        ActionDatabase.readDatabase();
        _updateActionsList();

        ActionRecognizer.instance.onRecognitionFinished = new RecognitionDoneDelegate(OnRecognitionEnd);
    }
Пример #2
0
        /// <summary>
        /// init databases and databases Wrappers
        /// </summary>
        public void setAndLoadDatabases()
        {
            _characterDatabase = Resources.LoadAll <CharacterDatabase>("")[0];
            _enemyDatabase     = Resources.LoadAll <EnemyDatabase>("")[0];
            _itemDatabase      = Resources.LoadAll <ItemDatabase>("")[0];
            _actionDatabase    = Resources.LoadAll <ActionDatabase>("")[0];

            reloadDatabases();
            setTreeElements();
        }
Пример #3
0
    public List <Tile> SetAttackTileRange(AttackType attType, Tile center)    //attack ignore collision and only check list not dictionary
    {
        AttackTypeData ad        = ActionDatabase.GetAttackData(attType);
        List <Tile>    rangeTile = new List <Tile>();

        int maxCost = ad.maxDist / 2;

        rangeTile = Pathfinding.DijkstraPathfinding(center, maxCost, CollisionCheckEnum.None).Keys.ToList();

        return(rangeTile);
    }
Пример #4
0
    public Dictionary <Tile, Tile> SetMovementTileRange(MovementType moveType, Tile center, CollisionCheckEnum colCheck)
    {
        ActionData ad = ActionDatabase.GetMovementData(moveType);
        Dictionary <Tile, Tile> rangeTile = new Dictionary <Tile, Tile>();

        int maxCost = ad.maxDist / 2;         //should be square so maxCost will always same

        rangeTile = Pathfinding.DijkstraPathfinding(center, maxCost, colCheck);

        return(rangeTile);
    }
 public static void readDatabase()
 {
     XmlSerializer xmls = new XmlSerializer(typeof(ActionDatabase));
     try
     {
         using (FileStream fs = new FileStream(Path.Combine(Application.dataPath,"database.xml"), FileMode.Open))
         {
             _actionDB = (ActionDatabase)xmls.Deserialize(fs);
         }
     } catch(FileNotFoundException e) {
         Debug.Log("File Not found");
         Debug.LogWarning(e.Message);
     }
 }
Пример #6
0
    public IEnumerator ActionDatabase_save_load()
    {
        ActionModel testData = new ActionModel
        {
            name = "testing"
        };
        ActionDatabase test = ScriptableObject.CreateInstance <ActionDatabase>(); // new ActionDatabase();

        test.actions.Add(testData);
        test.OnLoadData(test.OnSaveData());
        yield return(null);

        Assert.AreEqual(testData.name, test.actions[0].name);
    }
    public static void readDatabase()
    {
        XmlSerializer xmls = new XmlSerializer(typeof(ActionDatabase));

        try
        {
            using (FileStream fs = new FileStream(Path.Combine(Application.dataPath, "database.xml"), FileMode.Open))
            {
                _actionDB = (ActionDatabase)xmls.Deserialize(fs);
            }
        } catch (FileNotFoundException e) {
            Debug.Log("File Not found");
            Debug.LogWarning(e.Message);
        }
    }
    public void doAction(string actionType = "Wait")
    {//(wip) this script will be called when a creature inputs an action command
        if (isTurn)
        {
            if (numOfAvailibleActions > 0)
            {
                ActionDatabase actData = new ActionDatabase();
                Action         act     = actData.callUpAction(actionType);

                if (selectionChecker(act))
                {// wait for selection
                    currentAct       = act;
                    requestSelection = true;

                    Grid_Character_Movement Grid_Character_Movement = new Grid_Character_Movement();

                    Grid_Character_Movement.resetAreaOfMovement();

                    Grid_Character_Movement.findAreaOfMovement(currentX: Creature_Stats.currentX, currentY: Creature_Stats.currentY, currentZ: Creature_Stats.currentZ, numOfSteps: act.range);

                    print("target selection is needed");
                }
                else
                {// run without selection
                    Grid_Character_Movement Grid_Character_Movement = new Grid_Character_Movement();

                    Grid_Character_Movement.resetAreaOfMovement();

                    Grid_Character_Movement.findAreaOfMovement(currentX: Creature_Stats.currentX, currentY: Creature_Stats.currentY, currentZ: Creature_Stats.currentZ, numOfSteps: act.range);

                    outgoingActionProcessing(act: act, creaturePos: new int[] { Creature_Stats.currentX, Creature_Stats.currentY, Creature_Stats.currentZ }, targetPos: new int[, ] {
                        { Creature_Stats.currentX, Creature_Stats.currentY, Creature_Stats.currentZ }
                    });
                }
                print("this creature did something");
            }
            else
            {
                print("this creature has no more actions left");
            }
        }
        else
        {
            print("It is not this creatures turn");
        }
    }
Пример #9
0
    public bool TryAttackInsideRange(Tile target)
    {
        if (CheckAttackInsideRange(target))
        {
            AttackTypeData skill    = ActionDatabase.GetAttackData(currentAttackType);
            float          totalDmg = thisUnit.baseDmg * skill.dmgMulti;

            DamageManager.instance.SpawnDamager(totalDmg, skill.areaDamageRange, target.TileToWorldCoord(), thisUnit.foeType);
            SkillEffectManager.instance.SpawnSkillEffect(currentAttackType, target.TileToWorldCoord());

            return(true);
        }
        else
        {
            return(false);
        }
    }