Exemplo n.º 1
0
 /*				CONSTRUCTEUR			*/
 protected AI(Map map, Vector2 origin, Vector2 position, Vector2 size, Rectangle hitbox, CreatureType type = CreatureType.pacific, float vigilance = 5, float tenacity = 8, float height = 0, bool solid = true, float speed = 1000) : base(map, origin, position, size, hitbox, type, height, solid)
 {
     this.speed     = new Speed(speed);
     State          = new StandardState(this);
     this.vigilance = vigilance;
     this.tenacity  = tenacity;
 }
Exemplo n.º 2
0
 public Peach(ContentManager content, GraphicsDevice graphicsDevice)
 {
     Content             = content;
     graphics            = graphicsDevice;
     StandardSpriteSheet = content.Load <Texture2D>("Peach/StandardPeachSpriteSheet");
     FireSpriteSheet     = content.Load <Texture2D>("Peach/FirePeachSpriteSheet");
     SuperSpriteSheet    = content.Load <Texture2D>("Peach/SuperPeachSpriteSheet");
     StarSpriteSheet     = content.Load <Texture2D>("Peach/StarPeachSpriteSheet");
     fireBallPink        = content.Load <Texture2D>("FireBallPink");
     fireBallStar        = content.Load <Texture2D>("FireBallStar");
     fireBall            = content.Load <Texture2D>("FireBall");
     KillGoomba          = content.Load <SoundEffect>("Sound Effects/Stomp");
     Sprite = new AvatarSprite(graphicsDevice);
     Sprite.InitializeSprite(StandardSpriteSheet, graphicsDevice, 6, 6);
     Sprite.SwitchAnimation(Constants.ZERO, 6);
     PowerUpState             = new StandardState(new StandardState(null));
     Checkable                = true;
     ActionState              = new IdleState(this);
     Sprite.Acceleration      = new Vector2(Constants.ZERO, G);
     OnGround                 = true;
     frameCountA.frames       = 100; // invincibility ~ 1.5 s @ 60 fps
     frameCountA.currentFrame = Constants.ZERO;
     frameCountA.enabled      = false;
     Invincible               = false;
 }
Exemplo n.º 3
0
        public static StandardState Select(string value)
        {
            StandardState standardState;

            value = Common.ToTitleCase(value);
            var sql = "SELECT rowid, * " +
                      "FROM standardState " +
                      "WHERE value = @1";
            var dr = con.Select(sql, new List <object> {
                value
            });

            if (dr.HasRows)
            {
                dr.Read();
                standardState = GetObject(ref dr);
                dr.Close();
            }
            else
            {
                standardState = new StandardState()
                {
                    Value = value
                };
                standardState.Save();
            }

            return(standardState);
        }
Exemplo n.º 4
0
        private static StandardState GetObject(ref SqliteDataReader dr)
        {
            var standardState = new StandardState()
            {
                Id    = Convert.ToInt64(dr["rowid"]),
                Value = dr["value"].ToString()
            };

            return(standardState);
        }
Exemplo n.º 5
0
        public void StandardTransition(Peach peach)
        {
            var state = new StandardState(this);

            peach.PowerUpState = state;
            peach.SwitchToStandardSprite();
            if (peach.ActionState is CrouchingState)
            {
                peach.ActionState = new IdleState(peach);
                peach.Sprite      = PeachSpriteFactory.Instance.FactoryMethod(peach);
            }
        }
Exemplo n.º 6
0
    public void addState(BattleRoleData currentActionUnit, BattleRoleData propTargetUnit
                         , StandardState state
                         , SDConstants.AOEType aoeType = SDConstants.AOEType.None)
    {
        if (state.AimAtSelf)
        {
            propTargetUnit = currentActionUnit;
        }
        List <BattleRoleData> list
            = DealWithAOEAction(currentActionUnit, propTargetUnit, aoeType);

        for (int i = 0; i < list.Count; i++)
        {
            state.SimpleStartState(currentActionUnit, list[i]);
        }
    }
Exemplo n.º 7
0
        public static StandardState Select(long id)
        {
            StandardState standardState = null;
            var           sql           = "SELECT rowid, * " +
                                          "FROM standardState " +
                                          "WHERE rowid = @1";
            var dr = con.Select(sql, new List <object> {
                id
            });

            if (dr.HasRows)
            {
                dr.Read();
                standardState = GetObject(ref dr);
                dr.Close();
            }

            return(standardState);
        }
Exemplo n.º 8
0
    public void checkSpecialStr(string specialStr, string propid)
    {
        UseState = false;
        _state   = new StandardState(propid);
        functionsWithoutState = new List <string>();
        //state
        int lastTime = 0;
        List <StandardState.ChangeInRAL> ralList = new List <StandardState.ChangeInRAL>();

        //
        string[] strings = specialStr.Split('|');
        for (int i = 0; i < strings.Length; i++)
        {
            string[] tmp      = strings[i].Split(':');
            string   fn       = tmp[0];
            string[] paramStr = tmp[1].Split(',');
            if (fn.Contains("add") && paramStr.Length > 1)
            {
                UseState = true;
                int time = SDDataManager.Instance.getInteger(paramStr[1]);
                lastTime = Mathf.Max(lastTime, time);
                int        d = SDDataManager.Instance.getInteger(paramStr[0]);
                NumberData D = new NumberData(d);
                if (fn.Contains("_pc"))
                {
                    D.dataTag = NumberData.DataType.percent;
                }
                //
                if (fn.Contains("HP"))
                {
                    _state.ChangeInBarChart.HP = D;
                }
                else if (fn.Contains("MP"))
                {
                    _state.ChangeInBarChart.MP = D;
                }
                else if (fn.Contains("TP"))
                {
                    _state.ChangeInBarChart.TP = D;
                }
            }
            else if (fn.Contains("up_"))
            {
                UseState = true;
                int time = SDDataManager.Instance.getInteger(paramStr[1]);
                lastTime = Mathf.Max(lastTime, time);
                int        d = SDDataManager.Instance.getInteger(paramStr[0]);
                NumberData D = new NumberData(d);
                if (fn.Contains("_pc"))
                {
                    D.dataTag = NumberData.DataType.percent;
                }
                StandardState.ChangeInRAL cral;
                bool isad = ROHelp.CheckStringIsADElseST(fn.Split('_')[1]
                                                         , out AttributeData ad, out StateTag st);
                if (isad)
                {
                    cral = new StandardState.ChangeInRAL(D, ad);
                }
                else
                {
                    cral = new StandardState.ChangeInRAL(D, st);
                }
                ralList.Add(cral);
            }
            else if (fn.Contains("debuff_"))
            {
                StateTag tag = ROHelp.STATE_TAG(fn.Split('_')[1]);
                if (fn.Split('_')[1].ToLower() == "random")
                {
                    tag = (StateTag)(UnityEngine.Random.Range(0, (int)StateTag.End));
                }
                _state.stateTag = tag;
            }
            else if (fn.Contains("stateDmg"))
            {
                UseState = true;
                int time = SDDataManager.Instance.getInteger(paramStr[1]);
                lastTime = Mathf.Max(lastTime, time);
                int        d = SDDataManager.Instance.getInteger(paramStr[0]);
                NumberData D = new NumberData(d);
                if (fn.Contains("_pc"))
                {
                    D.dataTag = NumberData.DataType.percent;
                }
                _state.ExtraDmg = D;
            }
            //其余转为直接影响列表
            else
            {
                functionsWithoutState.Add(strings[i]);
            }
        }
    }
Exemplo n.º 9
0
 public StandardTransition <TTrigger> To(StandardState <TTrigger> to)
 {
     targetState = to;
     return(this);
 }
Exemplo n.º 10
0
 public StandardTransition <TTrigger> From(StandardState <TTrigger> from)
 {
     from.AddTransition(this);
     return(this);
 }
Exemplo n.º 11
0
 public void Awake()
 {
     standardState = new StandardState(this, GetComponent<CharacterController>());
     floatingState = new FloatingState(this, GetComponent<Rigidbody>());
     rockState = new RockState(this, GetComponent<Rigidbody>());
 }
 public void Awake()
 {
     standardState = new StandardState(this, GetComponent <CharacterController>());
     floatingState = new FloatingState(this, GetComponent <Rigidbody>());
     rockState     = new RockState(this, GetComponent <Rigidbody>());
 }
Exemplo n.º 13
0
 public void Remove(StandardState <TTrigger> state)
 {
     stateMachine.Remove(state);
 }
Exemplo n.º 14
0
 public void Add(StandardState <TTrigger> state)
 {
     stateMachine.Add(state);
 }
Exemplo n.º 15
0
 public InnerMachineState(StandardState <TTrigger> startState)
 {
     stateMachine = new StandardStateMachine <TTrigger>(startState);
 }