Пример #1
0
    override public void ShowGUI()
    {
        isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
        if (!isPlayer)
        {
            obToAffect = (GameObject)EditorGUILayout.ObjectField("Object to affect:", obToAffect, typeof(GameObject), true);
        }

        parentAction = (ParentAction)EditorGUILayout.EnumPopup("Method:", parentAction);
        if (parentAction == ParentAction.SetParent)
        {
            parentTransform = (Transform)EditorGUILayout.ObjectField("Parent to:", parentTransform, typeof(Transform), true);

            setPosition = EditorGUILayout.Toggle("Set local position?", setPosition);
            if (setPosition)
            {
                newPosition = EditorGUILayout.Vector3Field("Position vector:", newPosition);
            }

            setRotation = EditorGUILayout.Toggle("Set local rotation?", setRotation);
            if (setRotation)
            {
                newRotation = EditorGUILayout.Vector3Field("Rotation vector:", newRotation);
            }
        }

        AfterRunningOption();
    }
Пример #2
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
            if (!isPlayer)
            {
                obToAffectParameterID = Action.ChooseParameterGUI("Object to affect:", parameters, obToAffectParameterID, ParameterType.GameObject);
                if (obToAffectParameterID >= 0)
                {
                    obToAffectID = 0;
                    obToAffect   = null;
                }
                else
                {
                    obToAffect = (GameObject)EditorGUILayout.ObjectField("Object to affect:", obToAffect, typeof(GameObject), true);

                    obToAffectID = FieldToID(obToAffect, obToAffectID);
                    obToAffect   = IDToField(obToAffect, obToAffectID, false);
                }
            }

            parentAction = (ParentAction)EditorGUILayout.EnumPopup("Method:", parentAction);
            if (parentAction == ParentAction.SetParent)
            {
                parentTransformParameterID = Action.ChooseParameterGUI("Parent to:", parameters, parentTransformParameterID, ParameterType.GameObject);
                if (parentTransformParameterID >= 0)
                {
                    parentTransformID = 0;
                    parentTransform   = null;
                }
                else
                {
                    parentTransform = (Transform)EditorGUILayout.ObjectField("Parent to:", parentTransform, typeof(Transform), true);

                    parentTransformID = FieldToID(parentTransform, parentTransformID);
                    parentTransform   = IDToField(parentTransform, parentTransformID, false);
                }

                setPosition = EditorGUILayout.Toggle("Set local position?", setPosition);
                if (setPosition)
                {
                    newPosition = EditorGUILayout.Vector3Field("Position vector:", newPosition);
                }

                setRotation = EditorGUILayout.Toggle("Set local rotation?", setRotation);
                if (setRotation)
                {
                    newRotation = EditorGUILayout.Vector3Field("Rotation vector:", newRotation);
                }
            }

            AfterRunningOption();
        }
Пример #3
0
        public override bool Effect(CGObject s, Actor p1, Actor p2)
        {
            Action Root = ParentAction.FindRoot();

            //GameManager.DebugLog(Root.CGType);
            if (Root != null)
            {
                Root.Arm();
                Log.Print(this, "Rearming " + Root.CGType);
                return(true);
            }

            return(false);
        }
Пример #4
0
 /// <summary>
 /// Override GetHashCode for object
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = 1;
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ParentController != null ? ParentController.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ParentAction != null ? ParentAction.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ParentArea != null ? ParentArea.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Area != null ? Area.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Controller != null ? Controller.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Action != null ? Action.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Parent != null ? Parent.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ControllerSecurity != null ? ControllerSecurity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ActionSecurity != null ? ActionSecurity.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #5
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            isPlayer = EditorGUILayout.Toggle ("Is Player?", isPlayer);
            if (!isPlayer)
            {
                obToAffectParameterID = Action.ChooseParameterGUI ("Object to affect:", parameters, obToAffectParameterID, ParameterType.GameObject);
                if (obToAffectParameterID >= 0)
                {
                    obToAffectID = 0;
                    obToAffect = null;
                }
                else
                {
                    obToAffect = (GameObject) EditorGUILayout.ObjectField ("Object to affect:", obToAffect, typeof(GameObject), true);

                    obToAffectID = FieldToID (obToAffect, obToAffectID);
                    obToAffect = IDToField (obToAffect, obToAffectID, false);
                }
            }

            parentAction = (ParentAction) EditorGUILayout.EnumPopup ("Method:", parentAction);
            if (parentAction == ParentAction.SetParent)
            {
                parentTransformParameterID = Action.ChooseParameterGUI ("Parent to:", parameters, parentTransformParameterID, ParameterType.GameObject);
                if (parentTransformParameterID >= 0)
                {
                    parentTransformID = 0;
                    parentTransform = null;
                }
                else
                {
                    parentTransform = (Transform) EditorGUILayout.ObjectField ("Parent to:", parentTransform, typeof(Transform), true);

                    parentTransformID = FieldToID (parentTransform, parentTransformID);
                    parentTransform = IDToField (parentTransform, parentTransformID, false);
                }

                setPosition = EditorGUILayout.Toggle ("Set local position?", setPosition);
                if (setPosition)
                {
                    newPosition = EditorGUILayout.Vector3Field ("Position vector:", newPosition);
                }

                setRotation = EditorGUILayout.Toggle ("Set local rotation?", setRotation);
                if (setRotation)
                {
                    newRotation = EditorGUILayout.Vector3Field ("Rotation vector:", newRotation);
                }
            }

            AfterRunningOption ();
        }