Beispiel #1
0
        /// <summary>
        /// <para>Using another set of animations to override current set.</para>
        /// _setName should be one in the AnimDict,
        /// otherwise we assume there's no available set of anims to switch
        /// </summary>
        /// <param name="_setName"></param>
        public void OverrideWith(string _setName, bool _isForce = false)
        {
            // Stop if clips haven't been initialized
            // or we didn't have the animSet in AnimDict
            if (m_clipOverrides == null ||
                AnimDict.ContainsKey(_setName) == false)
            {
                return;
            }

            AnimatorStateInfo currentInfo = RealAnimator.GetCurrentAnimatorStateInfo(0);

            if (_isForce)
            {
                // LATER: Can we find a more elegant way or the native function to do this?
                foreach (KeyValuePair <AnimationClip, AnimationClip> pair in m_clipOverrides)
                {
                    m_clipOverrides[pair.Key.name] = null;
                }
            }
            AnimSet targetSet = AnimDict[_setName];

            foreach (string clipName in targetSet.Keys)
            {
                m_clipOverrides[clipName] = targetSet[clipName];
            }
            OverrideController.ApplyOverrides(m_clipOverrides);

            RealAnimator.Play(currentInfo.shortNameHash, 0, currentInfo.normalizedTime);
            CurrentSetName = _setName;
        }
Beispiel #2
0
    void Awake()
    {
        Transform  = transform;
        GameObject = gameObject;

        AnimSet = GetComponent <AnimSet> ();

        Memory      = new Memory();
        WorldState  = new WorldState();
        GoapManager = new GOAPManager(this);

        CharacterController = Transform.GetComponent <CharacterController> ();
        CollisionCenter     = CharacterController.center;

        Sound = Transform.GetComponent <ComponentSounds> ();

        BlackBoard.Owner        = this;
        BlackBoard.myGameObject = GameObject;

        ResetAgent();

        SetWorldState();
        WorldState.SetWSProperty(E_PropKey.E_LOOKING_AT_TARGET, false);
        WorldState.SetWSProperty(E_PropKey.E_USE_WORLD_OBJECT, false);

        EnableCollisions();
        //t = GameObject.Find ("GameObject").transform;
    }
        private void importFromPSAToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode n = treeView1.SelectedNode;

            if (n == null)
            {
                return;
            }
            int idx = GetRootIndex(n) - AT.Count;

            if (idx >= 0 && idx < AS.Count)
            {
                AnimSet        ans = AS[idx];
                OpenFileDialog d   = new OpenFileDialog {
                    Filter = "*.psa|*.psa"
                };
                if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (ans.ImportFromPSA(d.FileName))
                    {
                        MessageBox.Show("Done.");
                    }
                }
            }
        }
Beispiel #4
0
 public Character(Vector3 pos, Sprite sprite, SpriteManager sm)
 {
     this.pos      = pos;
     this.sprite   = sprite;
     this.sm       = sm;
     sprite.hidden = false;
     animSet       = new AnimSet(sprite, sm);
 }
Beispiel #5
0
        /// <summary>
        /// We can play a new set of anims to override animclips based on _animSet.Key
        /// </summary>
        /// <param name="_setName"></param>
        /// <param name="_animSet"></param>
        /// <param name="_isForce"></param>
        public void AddictivelyOverrideWith(string _setName, AnimSet _animSet, bool _isForce = false)
        {
            if (AnimDict.ContainsKey(_setName) == false)
            {
                AnimDict.Add(_setName, _animSet);
            }

            OverrideWith(_setName, _isForce);
        }
Beispiel #6
0
    public void AddAnim(int start, int frames, string name)
    {
        AnimSet a = new AnimSet( );

        a.name   = name;
        a.frames = frames;
        a.start  = start;
        anims.Add(a);

        setsprite( );
    }
Beispiel #7
0
 void Awake()
 {
     Transform               = transform;
     GameObject              = gameObject;
     AnimSet                 = GetComponent <AnimSet>();
     CharacterController     = transform.GetComponent <CharacterController>();
     CollisionCenter         = CharacterController.center;
     BlackBoard.Owner        = this;
     BlackBoard.myGameObject = GameObject;
     AnimSet                 = GetComponent <AnimSet>();
     t = GameObject.Find("GameObject").transform;
 }
Beispiel #8
0
    void Awake()
    {
        Transform  = transform;
        GameObject = gameObject;
        Controller = GetComponent <CharacterController>();
        AnimSet    = GetComponent <AnimSet>();
        Sound      = Transform.GetOrAdd <ComponentSound>();

        BlackBoard.Owner      = this;
        BlackBoard.GameObject = GameObject;

        CollisionCenter = Controller.center;
    }
Beispiel #9
0
    //only once throught whole level
    void Awake()
    {
        Transform           = transform;
        GameObject          = gameObject;
        Audio               = GetComponent <AudioSource>();
        CharacterController = Transform.GetComponent <CharacterController>();
        CollisionCenter     = CharacterController.center;

        BlackBoard.Owner        = this;
        BlackBoard.myGameObject = GameObject;

        AnimSet = GetComponent <AnimSet>();

        WorldState    = new WorldState();
        Memory        = new Memory();
        m_GoalManager = new GOAPManager(this);

        ResetAgent();

        WorldState.SetWSProperty(E_PropKey.E_ORDER, AgentOrder.E_OrderType.E_NONE);

        WorldState.SetWSProperty(E_PropKey.E_IDLING, true);
        WorldState.SetWSProperty(E_PropKey.E_AT_TARGET_POS, true);
        WorldState.SetWSProperty(E_PropKey.E_ATTACK_TARGET, false);
        WorldState.SetWSProperty(E_PropKey.E_LOOKING_AT_TARGET, false);
        WorldState.SetWSProperty(E_PropKey.E_USE_WORLD_OBJECT, false);
        WorldState.SetWSProperty(E_PropKey.E_PLAY_ANIM, false);

        WorldState.SetWSProperty(E_PropKey.E_IN_DODGE, false);
        WorldState.SetWSProperty(E_PropKey.E_IN_WEAPONS_RANGE, false);
        WorldState.SetWSProperty(E_PropKey.E_WEAPON_IN_HANDS, false);
        WorldState.SetWSProperty(E_PropKey.E_IN_BLOCK, false);
        WorldState.SetWSProperty(E_PropKey.E_ALERTED, false);
        WorldState.SetWSProperty(E_PropKey.E_IN_COMBAT_RANGE, false);
        WorldState.SetWSProperty(E_PropKey.E_AHEAD_OF_ENEMY, false);
        WorldState.SetWSProperty(E_PropKey.E_BEHIND_ENEMY, false);
        WorldState.SetWSProperty(E_PropKey.MoveToRight, false);
        WorldState.SetWSProperty(E_PropKey.MoveToLeft, false);
        WorldState.SetWSProperty(E_PropKey.E_TELEPORT, false);

        WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.None);


        //SetupActions();

        //SetupGoals();
    }
Beispiel #10
0
 public Robot.Robot CreateRobot(ILevel level, TileCoordinates coordinates, FlatDirection direction, RobotAction action)
 {
     return(new Robot.Robot(
                coordinates,
                direction,
                m_colour,
                m_immobile,
                m_required,
                action,
                m_guiColour,
                m_turnPreference,
                RobotModel,
                (m_robotAnimSet != null ? AnimSet.Get(m_robotAnimSet) : null),
                (m_robotSoundSet != null ? SoundSet.Get(m_robotSoundSet) : null),
                m_robotLightColour,
                m_robotLightRadius,
                Tile.RenderPass,
                Tile.CastShadows
                ));
 }
Beispiel #11
0
    void Awake()
    {
        Transform  = transform;
        GameObject = gameObject;

        AnimSet = GetComponent <AnimSet>();

        WorldState  = new WorldState();
        GoapManager = new GOAPManager(this);



        CharacterController = Transform.GetComponent <CharacterController>();
        CollisionCenter     = CharacterController.center;

        BlackBoard.Owner        = this;
        BlackBoard.myGameObject = GameObject;


        t = GameObject.Find("GameObject").transform;
    }
Beispiel #12
0
 public Robot(TileCoordinates position, FlatDirection direction, string colour, bool immobile, bool required, RobotAction initialAction, Vector3 guiColour, TurnDirection turnPreference, Model model, AnimSet animations, SoundSet sounds, Vector3?lightColour, float?lightRadius, RenderPass renderPass, bool castShadows)
 {
     m_colour         = colour;
     m_immobile       = immobile;
     m_required       = required;
     m_spawnAction    = initialAction;
     m_spawnPosition  = position;
     m_spawnDirection = direction;
     m_turnPreference = turnPreference;
     if (lightColour.HasValue && lightRadius.HasValue)
     {
         m_lightColour = lightColour.Value;
         m_light       = new PointLight(Vector3.Zero, lightColour.Value, lightRadius.Value);
     }
     m_modelInstance = new ModelInstance(model, Matrix4.Identity);
     m_animations    = animations;
     m_sounds        = sounds;
     m_guiColour     = guiColour;
     m_renderPass    = renderPass;
     m_castShadows   = castShadows;
 }
Beispiel #13
0
 public PlusAirDashInfo(AnimSet anims, Character character)
 {
     this.animSet   = anims;
     this.character = character;
 }
Beispiel #14
0
 public static AnimSet GetAnimSetByID(int ActorID)
 {
     SQLiteConnection Connection = new SQLiteConnection("Data Source=Assets/animation.db");
     Connection.Open();
     SQLiteCommand cmd = new SQLiteCommand(Connection);
     cmd.CommandText = "SELECT * from anim WHERE actorsno=" + ActorID;
     var reader = cmd.ExecuteReader();
     if (!reader.HasRows) return null;
     reader.Read();
     int start = reader.GetInt32(1); int end = reader.GetInt32(2);
     reader.Close();
     cmd.CommandText = "SELECT * from Animations WHERE animindex >" + start + " AND animindex <" + end;
     reader = cmd.ExecuteReader();
     AnimSet anim = new AnimSet();
     anim.ActorSNO = ActorID;
     while (reader.Read())
     {
         Animation ani = new Animation();
         ani.AniSNO = reader.GetInt32(1);
         ani.name = reader.GetString(2);
         ani.AniTagID = reader.GetInt32(3);
         anim.Animations.Add(ani);
     }
     Connection.Close();
     return anim;
 }