Пример #1
0
        public override void GuardianPostDrawScript(TerraGuardian guardian, Vector2 DrawPosition, Color color, Color armorColor, float Rotation, Vector2 Origin, float Scale, SpriteEffects seffect)
        {
            CilleData data = (CilleData)guardian.Data;

            if (data.InBeastState)
            {
                GuardianDrawData gdd = new GuardianDrawData(GuardianDrawData.TextureType.TGExtra, sprites.GetExtraTexture(MurderFaceID), DrawPosition, guardian.GetAnimationFrameRectangle(guardian.BodyAnimationFrame), Color.White, Rotation, Origin, Scale, seffect);
                InjectTextureAfter(GuardianDrawData.TextureType.TGBody, gdd);
            }
            switch (guardian.OutfitID)
            {
            case DefaultOutfitID:
            {
                Texture2D OutfitTexture    = sprites.GetExtraTexture(DefaultOutfitBodyID),
                          LeftArmTexture   = sprites.GetExtraTexture(DefaultOutfitLeftArmID),
                          RightArmTexture  = sprites.GetExtraTexture(DefaultOutfitRightArmID),
                          BodyFrontTexture = sprites.GetExtraTexture(DefaultOutfitBodyFrontID);
                GuardianDrawData gdd       = new GuardianDrawData(GuardianDrawData.TextureType.TGExtra, OutfitTexture, DrawPosition, guardian.GetAnimationFrameRectangle(guardian.BodyAnimationFrame), color, Rotation, Origin, Scale, seffect);
                InjectTextureAfter(GuardianDrawData.TextureType.TGBody, gdd);
                if (guardian.Base.BodyFrontFrameSwap.ContainsKey(guardian.BodyAnimationFrame))
                {
                    gdd = new GuardianDrawData(GuardianDrawData.TextureType.TGExtra, BodyFrontTexture, DrawPosition, guardian.GetAnimationFrameRectangle(BodyFrontFrameSwap[guardian.BodyAnimationFrame]), color, Rotation, Origin, Scale, seffect);
                    InjectTextureAfter(GuardianDrawData.TextureType.TGBodyFront, gdd);
                }
                gdd = new GuardianDrawData(GuardianDrawData.TextureType.TGExtra, LeftArmTexture, DrawPosition, guardian.GetAnimationFrameRectangle(guardian.LeftArmAnimationFrame), color, Rotation, Origin, Scale, seffect);
                InjectTextureAfter(GuardianDrawData.TextureType.TGLeftArm, gdd);
                gdd = new GuardianDrawData(GuardianDrawData.TextureType.TGExtra, RightArmTexture, DrawPosition, guardian.GetAnimationFrameRectangle(guardian.RightArmAnimationFrame), color, Rotation, Origin, Scale, seffect);
                InjectTextureAfter(GuardianDrawData.TextureType.TGRightArm, gdd);
            }
            break;
            }
        }
Пример #2
0
        public override void GuardianUpdateScript(TerraGuardian guardian)
        {
            CilleData data = (CilleData)guardian.Data;

            if (data.InBeastState)
            {
                if (guardian.KnockedOut)
                {
                    data.InBeastState = false;
                }
                else if (!TriggerBeastState(guardian))
                {
                    data.InBeastState = false;
                    if (!guardian.KnockedOut && !guardian.Downed)
                    {
                        string Message = "";
                        switch (Main.rand.Next(3))
                        {
                        default:
                            Message = "*Huh? It's over... I hope I didn't hurt anyone.*";
                            break;

                        case 1:
                            Message = "*What happened? Did someone got hurt?*";
                            break;

                        case 2:
                            Message = "*I'm so glad it's over. I didn't hurt anyone, right?*";
                            break;
                        }
                        guardian.SaySomethingCanSchedule(Message, false, Main.rand.Next(30, 180));
                    }

                    /*if (!guardian.DoAction.InUse)
                     * {
                     *  data.InBeastState = false;
                     * }*/
                }
                else
                {
                    if (guardian.OwnerPos > -1 && !guardian.IsPlayerBuddy(Main.player[guardian.OwnerPos]))
                    {
                        if (!NpcMod.HasGuardianNPC(guardian.ID, guardian.ModID))
                        {
                            WorldMod.GuardianTownNPC.Add(guardian);
                        }
                        Main.player[guardian.OwnerPos].GetModPlayer <PlayerMod>().DismissGuardian(guardian.ID, guardian.ModID);
                    }
                }
            }
            else
            {
                if (TriggerBeastState(guardian))
                {
                    if (!guardian.DoAction.InUse)
                    {
                        guardian.StartNewGuardianAction(new Companions.Creatures.Cille.BeastStateAction(), BeastStateID);
                    }
                }
            }
        }