// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (idleScript == null)
     {
         idleScript = GameObject.FindGameObjectWithTag("Player").GetComponent <IdleAnimation>();
     }
 }
Пример #2
0
 void Start()
 {
     rb            = this.GetComponent <Rigidbody>();
     animator      = GetComponentInChildren <Animator>();
     idelAnimation = new IdleAnimation();
     deadAnimation = new DeadAnimation();
     walkAnimation = new IdleAnimation();
     walkAnimation.Animate(animator, true);
 }
Пример #3
0
        public IObject ToItem(AGSSerializationContext context)
        {
            var     textComponent = TextComponent.ToItem(context);
            IButton button        = context.Factory.UI.GetButton(Object.ID, IdleAnimation.ToItem(context), HoverAnimation.ToItem(context),
                                                                 PushedAnimation.ToItem(context), 0, 0, null, "", null, false, textComponent.LabelRenderSize.Width, textComponent.LabelRenderSize.Height);

            Object.ToItem(context, button);
            button.TextConfig = textComponent.TextConfig;
            button.Text       = textComponent.Text;
            button.Visible    = Object.Visible;
            return(button);
        }
Пример #4
0
    public void EnableAnimationGroup(AnimType anim)
    {
        switch (anim)
        {
        case AnimType.IDLE:
            IdleAnimation idleAnimator = new IdleAnimation(species, "idle");
            idleAnim             = idleAnimator.idleAnim;
            idleAnim.groupActive = true;
            Debug.Log("idleAnim -> " + idleAnim.rootClip + ", " + idleAnim.FL_AnkleClip);
            break;

        case AnimType.WALK:

            break;
        }
    }
Пример #5
0
    protected virtual void Start()
    {
        speed = new Vector2(0, 0);

        direction = CharacterDirection.DOWN;
        status    = CharacterStatus.IDLE;

        baseSprite     = transform.Find("BaseSprite").gameObject;
        spriteRenderer = baseSprite.GetComponent <SpriteRenderer>();

        effectParent = transform.Find("EffectParent").gameObject;
        shadowParent = transform.Find("ShadowParent").gameObject;

        idleAnimation   = GetComponent <IdleAnimation>();
        walkAnimation   = GetComponent <WalkAnimation>();
        damageAnimation = GetComponent <DamageAnimation>();
        attackAnimation = GetComponent <AttackAnimation>();

        GameManager instaince = GameManager.Instance;
        GameObject  shadow    = instaince.spriteFactory.instatiateShadow(shadowParent, SpriteFactory.ShadowType.Midiam);

        shadow.transform.Translate(new Vector3(0, 0, -1));
    }
Пример #6
0
        public static Record CreateRecord(string Tag)
        {
            Record outRecord;

            switch (Tag)
            {
            case "TES4":
                outRecord = new Header();
                break;

            case "GMST":
                outRecord = new GameSetting();
                break;

            case "TXST":
                outRecord = new TextureSet();
                break;

            case "MICN":
                outRecord = new MenuIcon();
                break;

            case "GLOB":
                outRecord = new GlobalVariable();
                break;

            case "CLAS":
                outRecord = new Class();
                break;

            case "FACT":
                outRecord = new Faction();
                break;

            case "HDPT":
                outRecord = new HeadPart();
                break;

            case "HAIR":
                outRecord = new Hair();
                break;

            case "EYES":
                outRecord = new Eyes();
                break;

            case "RACE":
                outRecord = new Race();
                break;

            case "SOUN":
                outRecord = new Sound();
                break;

            case "ASPC":
                outRecord = new AcousticSpace();
                break;

            case "MGEF":
                outRecord = new MagicEffect();
                break;

            case "SCPT":
                outRecord = new Script();
                break;

            case "LTEX":
                outRecord = new LandscapeTexture();
                break;

            case "ENCH":
                outRecord = new ObjectEffect();
                break;

            case "SPEL":
                outRecord = new ActorEffect();
                break;

            case "ACTI":
                outRecord = new ESPSharp.Records.Activator();
                break;

            case "TACT":
                outRecord = new TalkingActivator();
                break;

            case "TERM":
                outRecord = new Terminal();
                break;

            case "ARMO":
                outRecord = new Armor();
                break;

            case "BOOK":
                outRecord = new Book();
                break;

            case "CONT":
                outRecord = new Container();
                break;

            case "DOOR":
                outRecord = new Door();
                break;

            case "INGR":
                outRecord = new Ingredient();
                break;

            case "LIGH":
                outRecord = new Light();
                break;

            case "MISC":
                outRecord = new MiscItem();
                break;

            case "STAT":
                outRecord = new Static();
                break;

            case "SCOL":
                outRecord = new StaticCollection();
                break;

            case "MSTT":
                outRecord = new MoveableStatic();
                break;

            case "PWAT":
                outRecord = new PlaceableWater();
                break;

            case "GRAS":
                outRecord = new Grass();
                break;

            case "TREE":
                outRecord = new Tree();
                break;

            case "FURN":
                outRecord = new Furniture();
                break;

            case "WEAP":
                outRecord = new Weapon();
                break;

            case "AMMO":
                outRecord = new Ammunition();
                break;

            case "NPC_":
                outRecord = new NonPlayerCharacter();
                break;

            case "CREA":
                outRecord = new Creature();
                break;

            case "LVLC":
                outRecord = new LeveledCreature();
                break;

            case "LVLN":
                outRecord = new LeveledNPC();
                break;

            case "KEYM":
                outRecord = new Key();
                break;

            case "ALCH":
                outRecord = new Ingestible();
                break;

            case "IDLM":
                outRecord = new IdleMarker();
                break;

            case "NOTE":
                outRecord = new Note();
                break;

            case "COBJ":
                outRecord = new ConstructibleObject();
                break;

            case "PROJ":
                outRecord = new Projectile();
                break;

            case "LVLI":
                outRecord = new LeveledItem();
                break;

            case "WTHR":
                outRecord = new Weather();
                break;

            case "CLMT":
                outRecord = new Climate();
                break;

            case "REGN":
                outRecord = new Region();
                break;

            case "NAVI":
                outRecord = new NavigationMeshInfoMap();
                break;

            case "DIAL":
                outRecord = new DialogTopic();
                break;

            case "QUST":
                outRecord = new Quest();
                break;

            case "IDLE":
                outRecord = new IdleAnimation();
                break;

            case "PACK":
                outRecord = new Package();
                break;

            case "CSTY":
                outRecord = new CombatStyle();
                break;

            case "LSCR":
                outRecord = new LoadScreen();
                break;

            case "ANIO":
                outRecord = new AnimatedObject();
                break;

            case "WATR":
                outRecord = new Water();
                break;

            case "EFSH":
                outRecord = new EffectShader();
                break;

            case "EXPL":
                outRecord = new Explosion();
                break;

            case "DEBR":
                outRecord = new Debris();
                break;

            case "IMGS":
                outRecord = new ImageSpace();
                break;

            case "IMAD":
                outRecord = new ImageSpaceAdapter();
                break;

            case "FLST":
                outRecord = new FormList();
                break;

            case "PERK":
                outRecord = new Perk();
                break;

            case "BPTD":
                outRecord = new BodyPartData();
                break;

            case "ADDN":
                outRecord = new AddonNode();
                break;

            case "AVIF":
                outRecord = new ActorValueInformation();
                break;

            case "RADS":
                outRecord = new RadiationStage();
                break;

            case "CAMS":
                outRecord = new CameraShot();
                break;

            case "CPTH":
                outRecord = new CameraPath();
                break;

            case "VTYP":
                outRecord = new VoiceType();
                break;

            case "IPCT":
                outRecord = new Impact();
                break;

            case "IPDS":
                outRecord = new ImpactDataSet();
                break;

            case "ARMA":
                outRecord = new ArmorAddon();
                break;

            case "ECZN":
                outRecord = new EncounterZone();
                break;

            case "MESG":
                outRecord = new Message();
                break;

            case "RGDL":
                outRecord = new Ragdoll();
                break;

            case "DOBJ":
                outRecord = new DefaultObjectManager();
                break;

            case "LGTM":
                outRecord = new LightingTemplate();
                break;

            case "MUSC":
                outRecord = new MusicType();
                break;

            case "IMOD":
                outRecord = new ItemMod();
                break;

            case "REPU":
                outRecord = new Reputation();
                break;

            case "RCPE":
                outRecord = new Recipe();
                break;

            case "RCCT":
                outRecord = new RecipeCategory();
                break;

            case "CHIP":
                outRecord = new CasinoChip();
                break;

            case "CSNO":
                outRecord = new Casino();
                break;

            case "LSCT":
                outRecord = new LoadScreenType();
                break;

            case "MSET":
                outRecord = new MediaSet();
                break;

            case "ALOC":
                outRecord = new MediaLocationController();
                break;

            case "CHAL":
                outRecord = new Challenge();
                break;

            case "AMEF":
                outRecord = new AmmoEffect();
                break;

            case "CCRD":
                outRecord = new CaravanCard();
                break;

            case "CMNY":
                outRecord = new CaravanMoney();
                break;

            case "CDCK":
                outRecord = new CaravanDeck();
                break;

            case "DEHY":
                outRecord = new DehydrationStage();
                break;

            case "HUNG":
                outRecord = new HungerStage();
                break;

            case "SLPD":
                outRecord = new SleepDeprivationStage();
                break;

            case "CELL":
                outRecord = new Cell();
                break;

            case "WRLD":
                outRecord = new Worldspace();
                break;

            case "LAND":
                outRecord = new GenericRecord();
                break;

            case "NAVM":
                outRecord = new NavigationMesh();
                break;

            case "INFO":
                outRecord = new DialogResponse();
                break;

            case "REFR":
                outRecord = new Reference();
                break;

            case "ACHR":
                outRecord = new PlacedNPC();
                break;

            case "ACRE":
                outRecord = new PlacedCreature();
                break;

            case "PGRE":
                outRecord = new PlacedGrenade();
                break;

            case "PMIS":
                outRecord = new PlacedMissile();
                break;

            default:
                Console.WriteLine("Encountered unknown record: " + Tag);
                outRecord = new GenericRecord();
                break;
            }

            outRecord.Tag = Tag;

            return(outRecord);
        }
Пример #7
0
 public override void SetAnimation(Animator animator)
 {
     IdleAnimation.SetState(animator);
 }
        protected override void OnUpdateAnimation()
        {
            if (Scene == null)
            {
                return;
            }

            var ea = Scene.View.Content.Peek <global::Graphics.Renderer.Renderer.EntityAnimation>(MetaEntityAnimation);

            if (State == UnitState.Alive)
            {
                if (actionAnimation != null)
                {
                    if (!actionAnimationPlaying)
                    {
                        actionAnimation.FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, actionAnimation.Animation);
                        ea.PlayAnimation(actionAnimation);
                        actionAnimationPlaying = true;
                        JumpAnimationStage     = JumpAnimationStage.None;
                    }
                    return;
                }

                if (IsOnGround)
                {
                    if (Running && CanControlMovement)
                    {
                        if (JumpAnimationStage == JumpAnimationStage.Falling)
                        {
                            JumpAnimationStage = JumpAnimationStage.None;
                        }
                        if (RunningBackwards)
                        {
                            if (!ea.PlayingAnimation.StartsWith("Backing") ||
                                ea.Paused)
                            {
                                string animName = GetAnimationName(UnitAnimations.Backing);
                                ea.PlayAnimation(new AnimationPlayParameters(
                                                     animName,
                                                     false, RunSpeed * BackingAnimationSpeed * GetAnimationSpeedMultiplier(animName),
                                                     AnimationTimeType.Speed, 0)
                                {
                                    FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName)
                                });
                            }
                            ea.SetTrackAnimationSpeed(RunSpeed * BackingAnimationSpeed);
                        }
                        else
                        {
                            var   animName = GetAnimationName(UnitAnimations.Run);
                            float ras      = RunAnimationSpeed;
                            if (RunSpeed >= FastRunStartAtSpeed)
                            {
                                ras      = FastRunAnimationSpeed;
                                animName = GetAnimationName(UnitAnimations.FastRun);
                            }
                            if (!ea.PlayingAnimation.StartsWith("Run") ||
                                ea.Paused)
                            {
                                ea.PlayAnimation(new AnimationPlayParameters(
                                                     animName,
                                                     false, RunSpeed * ras * GetAnimationSpeedMultiplier(animName),
                                                     AnimationTimeType.Speed, 0)
                                {
                                    FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName)
                                });
                            }
                            ea.SetTrackAnimationSpeed(RunSpeed * ras);
                        }
                    }
                    else
                    {
                        if (JumpAnimationStage == JumpAnimationStage.Falling)
                        {
                            var animName = GetAnimationName(UnitAnimations.Land);
                            ea.PlayAnimation(new AnimationPlayParameters(animName, false, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed)
                            {
                                FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName)
                            });
                            Program.Instance.SoundManager.GetSFX(Client.Sound.SFX.Land1).Play(new Client.Sound.PlayArgs {
                            });
                            JumpAnimationStage = JumpAnimationStage.Land;
                            return;
                        }
                        else
                        {
                            var an  = GetAnimationName(IdleAnimation);
                            var an2 = IdleAnimation.ToString();
                            if (!ea.PlayingAnimation.StartsWith(an2) ||
                                ea.Paused)
                            {
                                ea.PlayAnimation(new AnimationPlayParameters(an, false, GetAnimationSpeedMultiplier(an), AnimationTimeType.Speed)
                                {
                                    FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, an)
                                });
                            }
                            return;
                        }
                    }
                }
                else
                {
                    if (JumpAnimationStage == JumpAnimationStage.Jump)
                    {
                        if (!ea.PlayingAnimation.StartsWith("Jump"))
                        {
                            var animName = GetAnimationName(UnitAnimations.Jump);
                            ea.PlayAnimation(new AnimationPlayParameters(animName,
                                                                         false, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed)
                            {
                                FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName)
                            });
                        }
                    }
                    else if (JumpAnimationStage == JumpAnimationStage.Falling)
                    {
                        if (!ea.PlayingAnimation.StartsWith("Falling"))
                        {
                            var animName = GetAnimationName(UnitAnimations.Falling);
                            ea.PlayAnimation(new AnimationPlayParameters(animName,
                                                                         true, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed)
                            {
                                FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName)
                            });
                        }
                    }
                }
            }
            else if (State == UnitState.RaisingCorpse)
            {
                if (!ea.PlayingAnimation.StartsWith("RaiseDead"))
                {
                    var animName = GetAnimationName(UnitAnimations.RaiseDead);
                    ea.PlayAnimation(new AnimationPlayParameters(animName, false, RaiseFromCorpseTime * GetAnimationSpeedMultiplier(animName), AnimationTimeType.Length)
                    {
                        FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName)
                    });
                }
            }
            else if (State == UnitState.Dead || State == UnitState.RaisableCorpse || State == UnitState.HoldCorpse)
            {
                if (!ea.PlayingAnimation.StartsWith("Death"))
                {
                    var animName = GetAnimationName(UnitAnimations.Death);

                    ea.PlayAnimation(new AnimationPlayParameters(animName, false, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed, 0)
                    {
                        FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName)
                    });

                    if (Game.Instance != null)
                    {
                        if (Game.Instance.FrameId < 30)
                        {
                            ea.FreezeAtEnd();
                        }
                    }
                }
            }
        }