Beispiel #1
0
        public static void Write(Stream stream, List <SpawnPoint> items)
        {
            stream.Write(2);
            stream.Write(items.Count);
            foreach (var item in items)
            {
                BinaryMapping.WriteObject(stream, new Raw
                {
                    Type                 = item.Type,
                    Flag                 = item.Flag,
                    Id                   = item.Id,
                    EntityCount          = (short)item.Entities.Count,
                    EventActivatorCount  = (short)item.EventActivators.Count,
                    WalkPathCount        = (short)item.WalkPath.Count,
                    ReturnParameterCount = (short)item.ReturnParameters.Count,
                    SignalCount          = (short)item.Signals.Count,
                    Reserved10           = 0,
                    Reserved14           = 0,
                    Reserved18           = 0,
                    Place                = item.Teleport.Place,
                    Door                 = item.Teleport.Door,
                    World                = item.Teleport.World,
                    Unk1f                = item.Teleport.Unknown,
                    Unk20                = item.Unk20,
                    Unk24                = item.Unk24,
                    Unk28                = 0,
                });

                foreach (var spawnPoint in item.Entities)
                {
                    Entity.Write(stream, spawnPoint);
                }
                foreach (var unk in item.EventActivators)
                {
                    EventActivator.Write(stream, unk);
                }
                foreach (var unk in item.WalkPath)
                {
                    WalkPathDesc.Write(stream, unk);
                }
                foreach (var unk in item.ReturnParameters)
                {
                    ReturnParameter.Write(stream, unk);
                }
                foreach (var unk in item.Signals)
                {
                    Signal.Write(stream, unk);
                }
            }
        }
Beispiel #2
0
        public static void Write(Stream stream, List <SpawnPoint> items)
        {
            stream.Write(2);
            stream.Write(items.Count);
            foreach (var item in items)
            {
                BinaryMapping.WriteObject(stream, new Raw
                {
                    Unk00               = item.Unk00,
                    Unk02               = item.Unk02,
                    EntityCount         = (short)item.Entities.Count,
                    EventActivatorCount = (short)item.EventActivators.Count,
                    Unk08Count          = (short)item.WalkPath.Count,
                    Unk0aCount          = (short)item.Unknown0aTable.Count,
                    Unk0cCount          = (short)item.Unknown0cTable.Count,
                    Unk10               = 0,
                    Unk14               = 0,
                    Unk18               = 0,
                    Place               = item.Teleport.Place,
                    Door  = item.Teleport.Door,
                    World = item.Teleport.World,
                    Unk1f = item.Teleport.Unknown,
                    Unk20 = item.Unk20,
                    Unk24 = item.Unk24,
                    Unk28 = 0,
                });

                foreach (var spawnPoint in item.Entities)
                {
                    Entity.Write(stream, spawnPoint);
                }
                foreach (var unk in item.EventActivators)
                {
                    EventActivator.Write(stream, unk);
                }
                foreach (var unk in item.WalkPath)
                {
                    WalkPathDesc.Write(stream, unk);
                }
                foreach (var unk in item.Unknown0aTable)
                {
                    Unknown0a.Write(stream, unk);
                }
                foreach (var unk in item.Unknown0cTable)
                {
                    Unknown0c.Write(stream, unk);
                }
            }
        }
Beispiel #3
0
    public void NextEvent()
    {
        EventActivator ev = GetComponent <EventActivator>();

        if (ev.runEvent >= GetComponents <EventSetting>().Length - 1)
        {
            //Done
            ev.EndEvent();
        }
        else
        {
            ev.runEvent++;
            GetComponents <EventSetting>()[ev.runEvent].Activate();
        }
    }
Beispiel #4
0
 public static void Write(Stream stream, EventActivator unk) =>
 BinaryMapping.WriteObject(stream, new Raw
 {
     Unk00     = unk.Unk00,
     PositionX = unk.PositionX,
     PositionY = unk.PositionY,
     PositionZ = unk.PositionZ,
     ScaleX    = unk.ScaleX,
     ScaleY    = unk.ScaleY,
     ScaleZ    = unk.ScaleZ,
     RotationX = unk.RotationX,
     RotationY = unk.RotationY,
     RotationZ = unk.RotationZ,
     Unk28     = unk.Unk28,
     Unk2c     = unk.Unk2c,
 });
Beispiel #5
0
 public static void Write(Stream stream, EventActivator activator) =>
 BinaryMapping.WriteObject(stream, new Raw
 {
     Shape      = activator.Shape,
     Option     = activator.Option,
     PositionX  = activator.PositionX,
     PositionY  = activator.PositionY,
     PositionZ  = activator.PositionZ,
     ScaleX     = activator.ScaleX,
     ScaleY     = activator.ScaleY,
     ScaleZ     = activator.ScaleZ,
     RotationX  = activator.RotationX,
     RotationY  = activator.RotationY,
     RotationZ  = activator.RotationZ,
     Flags      = activator.Flags,
     Type       = activator.Type,
     OnBgGroup  = activator.OnBgGroup,
     OffBgGroup = activator.OffBgGroup,
 });
Beispiel #6
0
    void StartDialogue()
    {
        if (!showText)
        {
            print("You didn't Text source yet");
            return;
        }
        showText.gameObject.SetActive(true);
        if (imageVar)
        {
            imageVar.color = colorVar;
            imageVar.gameObject.SetActive(true);
        }
        if (imageVar2)
        {
            imageVar2.color = colorVar3;
            imageVar2.gameObject.SetActive(true);
        }
        if (textBoxVar)
        {
            textBoxVar.gameObject.SetActive(true);
        }
        if (nameText)
        {
            nameText.text = stringVar;
            nameText.gameObject.SetActive(true);
        }

        if (!showText.GetComponent <AnimateText>())
        {
            showText.gameObject.AddComponent <AnimateText>();
        }
        EventActivator ev = GetComponent <EventActivator>();

        showText.text = "";
        showText.GetComponent <AnimateText>().enabled = true;
        showText.GetComponent <AnimateText>().source  = GetComponents <EventSetting>()[ev.runEvent];
        showText.GetComponent <AnimateText>().StartAnimate(message);
    }
Beispiel #7
0
 private void SceneInteractionManager_AddInteractionActivator(On.SceneInteractionManager.orig_AddInteractionActivator orig, SceneInteractionManager self, EventActivator _activator)
 {
     OLogger.Log($"AddInteractionActivator");
 }
Beispiel #8
0
    //public static string spawnPointName = "";

    public void Activate()
    {
        if (type == ParametersType.Dialogue)
        {
            StartDialogue();
        }
        if (type == ParametersType.Wait)
        {
            StartCoroutine(Waiting());
        }
        if (type == ParametersType.ActivateOtherEvent)
        {
            eventVar.ActivateEvent();
            NextEvent();
        }
        if (type == ParametersType.SpawnPrefabAtObject)
        {
            if (targetIsPlayer)
            {
                SpawnPrefab(2);
            }
            else
            {
                SpawnPrefab(1);
            }
        }
        if (type == ParametersType.GoToEvent)
        {
            GoToEvent(intVar);
        }
        if (type == ParametersType.EnableObject)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            t.gameObject.SetActive(true);
            NextEvent();
        }
        if (type == ParametersType.DisableObject)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            t.gameObject.SetActive(false);
            NextEvent();
        }
        if (type == ParametersType.DeleteObject)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            if (t == this.gameObject)
            {
                //End Event if Delete this object
                GetComponent <EventActivator>().EndEvent();
            }
            Destroy(t.gameObject);
            NextEvent();
        }
        if (type == ParametersType.PlayLegacyAnimation)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            if (t.GetComponent <StatusC>() && t.GetComponent <StatusC>().mainModel)
            {
                t = t.GetComponent <StatusC>().mainModel.transform;
            }
            if (!t.GetComponent <Animation>())
            {
                print("Target not have Animation Component");
                NextEvent();
                return;
            }
            if (boolVar)
            {
                t.GetComponent <Animation>().Stop(animClip.name);
            }
            else
            {
                t.GetComponent <Animation>()[animClip.name].layer = intVar;
                t.GetComponent <Animation>().PlayQueued(animClip.name, QueueMode.PlayNow);
            }

            NextEvent();
        }
        if (type == ParametersType.PlayMecanimAnimation)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            if (t.GetComponent <StatusC>() && t.GetComponent <StatusC>().mainModel)
            {
                t = t.GetComponent <StatusC>().mainModel.transform;
            }
            if (!t.GetComponent <Animator>())
            {
                print("Target not have Animator Component");
                NextEvent();
                return;
            }

            if (boolVar)
            {
                t.GetComponent <Animator>().SetTrigger(stringVar);
            }
            else
            {
                t.GetComponent <Animator>().Play(animClip.name);
            }

            NextEvent();
        }
        if (type == ParametersType.ControlBoolean)
        {
            globalBoolean[intVar] = boolVar;
            NextEvent();
        }
        if (type == ParametersType.ControlVariable)
        {
            if (math == IntValueSet.Equal)
            {
                globalInt[intVar] = intVar2;
            }
            else if (math == IntValueSet.Plus)
            {
                globalInt[intVar] += intVar2;
            }
            else if (math == IntValueSet.Minus)
            {
                globalInt[intVar] -= intVar2;
            }
            else if (math == IntValueSet.Multiply)
            {
                globalInt[intVar] *= intVar2;
            }
            else if (math == IntValueSet.Divide)
            {
                globalInt[intVar] /= intVar2;
            }
            //print(globalInt[intVar]);
            NextEvent();
        }

        if (type == ParametersType.PlayBGM)
        {
            if (!target)
            {
                print("No Audio Source");
                NextEvent();
                return;
            }
            if (!target.GetComponent <AudioSource>())
            {
                target.gameObject.AddComponent <AudioSource>();
            }
            if (boolVar)
            {
                target.GetComponent <AudioSource>().Stop();
            }
            else
            {
                target.GetComponent <AudioSource>().clip = audiClip;
                target.GetComponent <AudioSource>().loop = boolVar2;
                target.GetComponent <AudioSource>().Play();
            }
            NextEvent();
        }

        if (type == ParametersType.PlayOneShotAudio)
        {
            if (!target)
            {
                print("No Audio Source");
                NextEvent();
                return;
            }
            if (!target.GetComponent <AudioSource>())
            {
                target.gameObject.AddComponent <AudioSource>();
            }
            target.GetComponent <AudioSource>().PlayOneShot(audiClip);
            NextEvent();
        }

        if (type == ParametersType.ChangeScene)
        {
            if (!mainPlayer)
            {
                mainPlayer = GameObject.FindWithTag("Player");
            }
            if (!mainPlayer)
            {
                print("No Player in the scene");
            }
            if (boolVar)
            {
                mainPlayer.GetComponent <StatusC>().spawnPointName = stringVar2;
            }
            GameObject[] gos = GameObject.FindGameObjectsWithTag("Mount");
            if (gos.Length > 0)
            {
                foreach (GameObject go in gos)
                {
                    go.SendMessage("DestroySelf", SendMessageOptions.DontRequireReceiver);
                }
            }
            //Application.LoadLevel(stringVar);
            SceneManager.LoadScene(stringVar, LoadSceneMode.Single);
            NextEvent();
        }

        if (type == ParametersType.SetObjectLocation)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            target.localPosition = vector3Var;
            NextEvent();
        }

        if (type == ParametersType.SetObjectRotation)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            if (target2)
            {
                vector3Var = target2.eulerAngles;
            }
            target.eulerAngles = vector3Var;
            NextEvent();
        }

        if (type == ParametersType.SetObjectAtObjectPosition)
        {
            Transform t = SetTarget();
            if (!t || !target2)
            {
                print("You didn't assign Target yet");
                NextEvent();
                return;
            }
            target.position = target2.position;
            target.rotation = target2.rotation;
            NextEvent();
        }

        if (type == ParametersType.FreezeAll)
        {
            GlobalConditionC.freezeAll = boolVar;
            NextEvent();
        }

        if (type == ParametersType.MoveObjectTowards)
        {
            Transform t = SetTarget();
            if (boolVar5)
            {
                target2 = GameObject.FindWithTag("Player").transform;
            }
            if (!t || !target2)
            {
                print("You didn't assign Destination Object at Target yet");
                NextEvent();
                return;
            }
            if (!t.GetComponent <MovingLookingEvent>())
            {
                t.gameObject.AddComponent <MovingLookingEvent>();
            }
            t.GetComponent <MovingLookingEvent>().destinationObject      = target2;
            t.GetComponent <MovingLookingEvent>().moveSpeed              = floatVar;
            t.GetComponent <MovingLookingEvent>().useCharacterController = boolVar;
            t.GetComponent <MovingLookingEvent>().reachDistance          = floatVar2;
            t.GetComponent <MovingLookingEvent>().sendMsgWhenReact       = msgString;
            t.GetComponent <MovingLookingEvent>().stopWhenReach          = stopMoving;

            t.GetComponent <MovingLookingEvent>().onMoving = true;
            if (boolVar2)
            {
                t.GetComponent <MovingLookingEvent>().lookAtObject = target2;
                t.GetComponent <MovingLookingEvent>().lockYAngle   = boolVar3;
                t.GetComponent <MovingLookingEvent>().onLooking    = true;
            }
            if (sendBack)
            {
                EventActivator ev = GetComponent <EventActivator>();
                t.GetComponent <MovingLookingEvent>().source      = GetComponents <EventSetting>()[ev.runEvent];
                t.GetComponent <MovingLookingEvent>().stopSending = false;
            }
            else
            {
                NextEvent();
            }
        }

        if (type == ParametersType.LookAtTarget)
        {
            Transform t = SetTarget();
            if (!t || !target2 && !boolVar3)
            {
                print("You didn't assign Look At Object at Target yet");
                NextEvent();
                return;
            }
            if (boolVar3)
            {
                //Look At Player
                if (!mainPlayer)
                {
                    mainPlayer = GameObject.FindWithTag("Player");
                }
                if (!mainPlayer)
                {
                    print("No Player in the scene");
                    NextEvent();
                    return;
                }
                target2 = mainPlayer.transform;
            }

            if (boolVar)
            {
                if (!t.GetComponent <MovingLookingEvent>())
                {
                    t.gameObject.AddComponent <MovingLookingEvent>();
                }
                t.gameObject.GetComponent <MovingLookingEvent>().lookAtObject = target2;
                t.gameObject.GetComponent <MovingLookingEvent>().lockYAngle   = boolVar2;
                t.gameObject.GetComponent <MovingLookingEvent>().lookSpeed    = floatVar;
                t.gameObject.GetComponent <MovingLookingEvent>().onLooking    = true;
            }
            else
            {
                if (t.GetComponent <MovingLookingEvent>())
                {
                    t.gameObject.GetComponent <MovingLookingEvent>().onLooking = false;
                }
                Vector3 lookPos = target2.position;
                if (boolVar2)
                {
                    lookPos.y = t.position.y;
                }
                t.LookAt(lookPos);
            }
            NextEvent();
        }

        if (type == ParametersType.SetParent)
        {
            if (boolVar && GlobalConditionC.mainPlayer)
            {
                target2 = GlobalConditionC.mainPlayer.transform;
            }
            if (target && target2)
            {
                target.parent = target2;
            }
            NextEvent();
        }

        if (type == ParametersType.Unparent)
        {
            if (target)
            {
                target.parent = null;
            }
            NextEvent();
        }

        if (type == ParametersType.AmbientEditor)
        {
            SetSkyFog();
        }

        if (type == ParametersType.LightEditor)
        {
            SetLight();
        }

        if (type == ParametersType.SetTimeScale)
        {
            Time.timeScale = floatVar3;
            NextEvent();
        }

        if (type == ParametersType.SendMessage)
        {
            if (target)
            {
                target.SendMessage(msgString, SendMessageOptions.DontRequireReceiver);
            }
            else
            {
                SendMessage(msgString, SendMessageOptions.DontRequireReceiver);
            }
            NextEvent();
        }

        if (type == ParametersType.StopMovingAndLooking)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }
            if (!t.GetComponent <MovingLookingEvent>())
            {
                NextEvent();
                return;
            }
            if (boolVar)
            {
                t.gameObject.GetComponent <MovingLookingEvent>().onMoving = false;
            }
            if (boolVar2)
            {
                t.gameObject.GetComponent <MovingLookingEvent>().onLooking = false;
            }
            NextEvent();
        }

        if (type == ParametersType.BreakEvent)
        {
            GetComponent <EventActivator>().EndEvent();
        }

        if (type == ParametersType.ScreenShake)
        {
            ShakeCamera();
        }

        if (type == ParametersType.FadeImage)
        {
            if (!imageVar)
            {
                print("You didn't assign Image");
                NextEvent();
                return;
            }
            if (!imageVar.GetComponent <FadeImage>())
            {
                imageVar.gameObject.AddComponent <FadeImage>();
            }
            //imageVar.color = colorVar;
            imageVar.GetComponent <FadeImage>().SetFirstColor(colorVar);
            imageVar.GetComponent <FadeImage>().startColor = colorVar;
            imageVar.GetComponent <FadeImage>().endColor   = colorVar2;
            imageVar.GetComponent <FadeImage>().lerpSpeed  = floatVar3;
            imageVar.GetComponent <FadeImage>().fading     = true;
            NextEvent();
        }

        if (type == ParametersType.ConditionCheck)
        {
            bool pass = false;
            if (boolVar)
            {
                pass = globalBoolean[intVar];
            }
            else
            {
                pass = CheckCondition();
            }
            if (pass)
            {
                //Condition Pass
                if (msgString != "")
                {
                    SendMessage(msgString, SendMessageOptions.DontRequireReceiver);
                }
                GetComponent <EventActivator>().runEvent = intVar3;
                GetComponents <EventSetting>()[GetComponent <EventActivator>().runEvent].Activate();
            }
            else
            {
                //Condition Fail
                if (msgString2 != "")
                {
                    SendMessage(msgString2, SendMessageOptions.DontRequireReceiver);
                }
                GetComponent <EventActivator>().runEvent = intVar4;
                GetComponents <EventSetting>()[GetComponent <EventActivator>().runEvent].Activate();
            }
        }

        if (type == ParametersType.MoveImage)
        {
            if (!imageVar)
            {
                print("You didn't assign Image source yet");
                NextEvent();
                return;
            }
            imageVar.gameObject.SetActive(true);
            if (!imageVar.GetComponent <MoveImage>())
            {
                imageVar.gameObject.AddComponent <MoveImage>();
            }
            if (boolVar4)
            {
                imageVar.GetComponent <MoveImage>().destinationPosition = vector3Var;
                imageVar.GetComponent <MoveImage>().speed = floatVar4;
            }
            imageVar.GetComponent <MoveImage>().onMoving = boolVar4;
            if (boolVar2)
            {
                imageVar.GetComponent <MoveImage>().size         = vector2Var;
                imageVar.GetComponent <MoveImage>().scalingSpeed = floatVar5;
            }
            imageVar.GetComponent <MoveImage>().onScaling = boolVar2;
            NextEvent();
        }

        if (type == ParametersType.SetCameraTarget)
        {
            Transform t = SetTarget();
            if (!t)
            {
                NextEvent();
                return;
            }

            /*if(Camera.main.GetComponent<ARPGcamera>()){
             *      Camera.main.GetComponent<ARPGcamera>().enabled = !boolVar2;
             * }*/
            GlobalConditionC.freezeCam = boolVar2;
            if (Camera.main.GetComponent <ARPGcameraC>())
            {
                Camera.main.GetComponent <ARPGcameraC>().SetNewTarget(t);
            }
            else
            {
                Camera.main.SendMessage("SetNewTarget", t, SendMessageOptions.DontRequireReceiver);
            }
            if (boolVar3)
            {
                Camera.main.transform.position = t.position;
                Camera.main.transform.rotation = t.rotation;
            }
            NextEvent();
        }

        if (type == ParametersType.LockCamera)
        {
            GlobalConditionC.freezeCam = boolVar;
            NextEvent();
        }

        if (type == ParametersType.AddCash)
        {
            if (GlobalConditionC.mainPlayer)
            {
                GlobalConditionC.mainPlayer.GetComponent <InventoryC>().cash += intVar;
            }
            NextEvent();
        }
        if (type == ParametersType.AddSkillPoint)
        {
            if (GlobalConditionC.mainPlayer)
            {
                GlobalConditionC.mainPlayer.GetComponent <StatusC>().skillPoint += intVar;
            }
            NextEvent();
        }
        if (type == ParametersType.AddStatusPoint)
        {
            if (GlobalConditionC.mainPlayer)
            {
                GlobalConditionC.mainPlayer.GetComponent <StatusC>().statusPoint += intVar;
            }
            NextEvent();
        }
        if (type == ParametersType.AddItem)
        {
            if (GlobalConditionC.mainPlayer)
            {
                GlobalConditionC.mainPlayer.GetComponent <InventoryC>().AddItem(intVar, intVar2);
            }
            NextEvent();
        }
        if (type == ParametersType.AddEquipment)
        {
            if (GlobalConditionC.mainPlayer)
            {
                GlobalConditionC.mainPlayer.GetComponent <InventoryC>().AddEquipment(intVar);
            }
            NextEvent();
        }
        if (type == ParametersType.AddQuest)
        {
            if (GlobalConditionC.mainPlayer)
            {
                GlobalConditionC.mainPlayer.GetComponent <QuestStatC>().AddQuest(intVar);
            }
            NextEvent();
        }
    }