コード例 #1
0
ファイル: phyFunc.cs プロジェクト: mrpossoms/AnimoNex
        public static Base updateProjectile(Base Object)
        {
            Object = AccelerateProj(Object);
            Object = TranslateProj(Object);

            return Object;
        }
コード例 #2
0
ファイル: phyFunc.cs プロジェクト: mrpossoms/AnimoNex
        private static Base Accelerate(Base Object)
        {
            Object.v_velocity *= .4f;
            //Object.f_angular_velocity *= .98f;

            if (Object.f_Position_Z > 0.1f)
            {
                Object.f_Velocity_Z += gravity;
                Object.airBorn = true;
                Object.v_velocity *= 1.6f;

                if (Object.f_angular_velocity == 0)
                {
                    Object.f_angular_velocity = gfunc.RandomNumber(-0.1, 0.1);
                }
            }
            else
            {
                Object.airBorn = false;

                if (Object.f_Velocity_Z < 0.5f)
                {

                    if (Math.Abs(Object.f_Velocity_Z) > 0.1)
                    {
                        Object.f_Velocity_Z = -(Object.f_Velocity_Z * Object.f_elasticity);
                    }
                    else
                    {
                        Object.f_Velocity_Z = 0;
                    }

                    Object.f_angular_velocity = 0;
                    if(Object.f_Velocity_Z!=0)
                    {
                        if (Object.f_angle < (float)Math.PI / 4)
                        {
                            Object.f_angle = 0 + gfunc.RandomNumber(-0.1, 0.1);
                        }
                        else
                        {
                            Object.f_angle = (float)Math.PI + gfunc.RandomNumber(-0.1, 0.1);
                        }
                    }
                }
            }

            return Object;
        }
コード例 #3
0
ファイル: camera.cs プロジェクト: mrpossoms/AnimoNex
        public static void follow(Base B_Object,float height,float angle,bool pointingRight)
        {
            Vector2 Object = B_Object.v_position - new Vector2(0, B_Object.f_Position_Z);

            Object.Y -= height / 2;
            Vector2 temp = Game1.v_resolution / 2;
            Vector2 oldCamPos = v_pos;

            if (pointingRight)
            {
                temp.X /= 4;
            }
            else
            {
                temp.X = Game1.v_resolution.X-(temp.X / 4);
            }
            Object -= temp;

            float f_velocity = (Vector2.Distance(v_pos, Object) / (f_deltaV * 0.1f));
            Vector2 newVelocity = gfunc.TranslateOnAng(f_velocity,gfunc.PointAt(v_pos, Object));  //find the new velocity
            newVelocity.Y += (Game1.v_resolution.Y / (float)Math.PI) * (float)Math.Sin(angle);

            int floor = LvlFunc.findFloor(world.levels[world.i_currentLvl]);

            v_pos.X += newVelocity.X;
            if (!LvlFunc.isInRegion(new Vector2(0, Game1.v_resolution.Y) + v_pos, world.levels[world.i_currentLvl].regions[floor]) ||
                !LvlFunc.isInRegion(Game1.v_resolution + v_pos, world.levels[world.i_currentLvl].regions[floor]))
            {
                v_pos.X = oldCamPos.X;
            }
            v_pos.Y += newVelocity.Y;
            if (!LvlFunc.isInRegion(new Vector2(0, Game1.v_resolution.Y)+v_pos, world.levels[world.i_currentLvl].regions[floor]) ||
                !LvlFunc.isInRegion(Game1.v_resolution + v_pos, world.levels[world.i_currentLvl].regions[floor]))
            {
                v_pos.Y = oldCamPos.Y;
            }

            //v_pos.Y += ;
        }
コード例 #4
0
ファイル: phyFunc.cs プロジェクト: mrpossoms/AnimoNex
        private static Base AccelerateProj(Base Object)
        {
            //Object.v_velocity *= .4f;

            if (Object.f_Position_Z > 0.1f)
            {
                //Object.f_Velocity_Z += gravity;
                Object.airBorn = true;
                //Object.v_velocity *= 1.6f;
            }
            else
            {
                Object.airBorn = false;
            }

            return Object;
        }
コード例 #5
0
ファイル: phyFunc.cs プロジェクト: mrpossoms/AnimoNex
        private static Base TranslateProj(Base Object)
        {
            Vector2 oldPos = Object.v_position;

            Object.v_position += Object.v_velocity;
            Object.f_Position_Z += Object.f_Velocity_Z;

            return Object;
        }
コード例 #6
0
ファイル: phyFunc.cs プロジェクト: mrpossoms/AnimoNex
        private static Base Translate(Base Object)
        {
            Vector2 oldPos = Object.v_position;

            Object.f_Position_Z += Object.f_Velocity_Z;
            Object.f_angle += Object.f_angular_velocity;

            Object.v_position.X += Object.v_velocity.X;
            if (!LvlFunc.isInRegion(Object.v_position, regionType.floor))
            {
                Object.v_position.X = oldPos.X;
                //Object.v_velocity = Vector2.Zero;
            }
            Object.v_position.Y += Object.v_velocity.Y;
            if (!LvlFunc.isInRegion(Object.v_position, regionType.floor))
            {
                Object.v_position.Y = oldPos.Y;
                //Object.v_velocity = Vector2.Zero;
            }

            return Object;
        }
コード例 #7
0
ファイル: types.cs プロジェクト: mrpossoms/AnimoNex
 public Projectile(Texture2D Texture, Base b_base, ProjectileType Type, float Life)
 {
     texture = Texture;
     B_base = b_base;
     type = Type;
     lived = 0;
     damage = 0;
     maxLife = Life;
     owner = -1;
 }
コード例 #8
0
ファイル: types.cs プロジェクト: mrpossoms/AnimoNex
 public item(Base B_Base, Texture2D Tex, Texture2D Ico, string Name, string tag, string Spec, float Quality, itemType Type)
 {
     B_base = B_Base;
     texture = Tex;
     icon = Ico;
     name = Name;
     gameTag = tag;
     quality = Quality;
     special = Spec;
     type = Type;
     description = " ";
     weight = 1;
     usable = true;
 }
コード例 #9
0
ファイル: types.cs プロジェクト: mrpossoms/AnimoNex
 public character(string Name, Vector2 Position, skill Skill, ControlType CType, CharType type)
 {
     controlType = CType;
     action = "idle";
     special_tag = -1;
     Type = type;
     name = Name;
     B_baseProps = new Base(Position, 70f);
     f_currentFrame = 0;
     body = null;
     currentAnim = new Animation();
     angle = 0;
     accuracy = 1;
     attrib = Skill;
     armor = 0;
     pointingRight = true;
     Primary_weap = Secondary_weap = SideArm_weap = current_weap = new weapon();
     Inventory = new inventory(5, null);
     weaponInUse = "unarmed";
     brain = new AInode(false);
     reordered = false;
 }