public override void Init(ICEWorldBehaviour _component) { base.Init(_component); if (_component != null && Enabled && _component.GetComponent <LineRenderer>() != null) { m_Transform = _component.transform; m_LineRenderer = _component.GetComponent <LineRenderer>(); if (m_LineRenderer != null) { #if UNITY_5_5 || UNITY_5_5_OR_NEWER m_LineRenderer.startWidth = Width; m_LineRenderer.endWidth = Width; #else m_LineRenderer.SetWidth(Width, Width); #endif m_LineRenderer.material = new Material(Shader.Find("Particles/Additive")); } m_LaserOffset = new Vector3(0, 0, 0); EndEffect = _component.GetComponentInChildren <ParticleSystem>(); if (EndEffect != null) { m_LaserEndEffectTransform = EndEffect.transform; } } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); Sound.Init(_component); Effect.Init(_component); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); StandByBehaviour.Init(_component); OperationBehaviour.Init(_component); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); SurfaceHandler.Init(_component); CollisionHandler.Init(_component); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); m_StartDateTimeInSecondes = DateTools.DateTimeToSeconds(StartYear, StartMonth, StartDay, 0, 0, 0) + m_DaytimeInSeconds; m_WorldTimeInSeconds = StartDateTimeInSecondes; }
public ICEOwnerObject(ICEOwnerObject _object) : base(_object) { m_OwnerComponent = (_object != null?_object.OwnerComponent:null); m_Owner = (m_OwnerComponent != null ? m_OwnerComponent.gameObject:null); EnableDebugLog = _object.EnableDebugLog; }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); if (Owner == null || OwnerComponent == null) { return; } m_DefaultFogEnabled = RenderSettings.fog; m_DefaultFogColor = RenderSettings.fogColor; m_DefaultFogDensity = RenderSettings.fogDensity; m_DefaultSkybox = RenderSettings.skybox; m_Camera = OwnerComponent.GetComponent <Camera>(); if (m_Camera == null) { m_Camera = Camera.main; } if (m_Camera != null) { //TODO: m_DefaultBackgroundColor = m_Camera.backgroundColor; m_Camera.backgroundColor = UnderwaterBackgroundColor; } if (!UseWaterZone) { OwnerComponent.OnUpdate += Update; } }
public TargetObject PrepareTarget(ICEWorldBehaviour _component) { if (!OwnerIsReady(_component) || Target.PrepareTargetGameObject(_component) == null || !Target.IsValidAndReady) { return(null); } Target.Behaviour.SetDefault(); // if the creature outside the max range it have to travel to reach its target if (!Target.TargetInMaxRange(Owner.transform.position)) { Target.Behaviour.CurrentBehaviourModeKey = BehaviourModeTravel; } // if the creature reached the TargetMovePosition it should do the rendezvous behaviour else if (Target.TargetMovePositionReached(Owner)) { Target.Behaviour.CurrentBehaviourModeKey = BehaviourModeRendezvous; } // in all other case the creature should be standby and do some leisure activities else { Target.Behaviour.CurrentBehaviourModeKey = BehaviourModeLeisure; } return(Target); }
/* * private CreatureObject m_Creature = null; * protected CreatureObject GetCreature() * { * if( m_Creature == null ) * m_Creature = Owner.GetComponent<ICECreatureControl>().Creature; * * return m_Creature; * }*/ public TargetObject PrepareTarget(ICEWorldBehaviour _component) { if (!Enabled || !OwnerIsReady(_component) || Target.PrepareTargetGameObject(_component) == null || !Target.IsValidAndReady) { return(null); } Target.Behaviour.SetDefault(); // if the active target is not a OUTPOST or if the creature outside the max range it have to travel to reach its target //if( _creature.ActiveTarget == null || _creature.ActiveTarget.Type != TargetType.OUTPOST || ! Target.TargetInMaxRange( _owner.transform.position )) if (!Target.TargetInMaxRange(Owner.transform.position)) { Target.Behaviour.CurrentBehaviourModeKey = BehaviourModeTravel; } // if the creature reached the TargetMovePosition it should do the rendezvous behaviour else if (Target.TargetMoveComplete) { Target.Behaviour.CurrentBehaviourModeKey = BehaviourModeRendezvous; } // in all other case the creature should be standby and do some leisure activities else if (Target.Move.HasRandomRange) { Target.Behaviour.CurrentBehaviourModeKey = BehaviourModeLeisure; } return(Target); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); if (Light != null && Application.isPlaying) { Light.enabled = false; } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); if (Owner != null) { m_InitialRotation = Owner.transform.localRotation; } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); foreach (WaypointLinkObject _link in Links) { _link.Init(_component); } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); foreach (InventorySlotObject _slot in Slots) { _slot.Init(Owner); } }
public void Stop(ICEWorldBehaviour _component) { ICECreatureControl _control = _component as ICECreatureControl; if (base.Stop() && _control != null) { _control.Creature.UpdateStatusInfluences(this); } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); if (FireLight == null && _component != null) { FireLight = _component.GetComponentInChildren <Light>(); } }
public static void Reset(ICEWorldBehaviour _behaviour) { HelpButtonIndex = 0; HelpEnabled = _behaviour.ShowHelp; NotesEnabled = _behaviour.ShowNotes; ICEEditorLayout.SetColors(true); }
public virtual bool OwnerIsReady(ICEWorldBehaviour _component) { if (_component != null && _component != m_OwnerComponent) { m_OwnerComponent = _component; m_Owner = (m_OwnerComponent != null ? m_OwnerComponent.gameObject:null); } return(m_OwnerComponent != null || m_Owner != null ? true : false); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); LaunchSound.Init(_component); Ammunition.Init(_component); MuzzleFlash.Init(_component); Recoil.Init(_component); Effect.Init(_component); }
public void TrySetOwner(GameObject _object) { if (_object == m_Owner) { return; } m_Owner = _object; m_OwnerComponent = (_object != null ? _object.GetComponent <ICEWorldBehaviour>():null); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); if (Owner != null) { m_Animation = Owner.GetComponentInChildren <Animation>(); m_Animator = Owner.GetComponentInChildren <Animator>(); } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); BehaviourAnimation.Init(_component); for (int i = 0; i < BehaviourModes.Count; i++) { m_BehaviourModesKeys.Add(BehaviourModes[i].Key, i); } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); // TODO: it could be that there is no main cam ... if (Application.isPlaying && Camera.main != null) { m_DefaultCameraBackgroundColor = Camera.main.backgroundColor; m_DefaultCameraCameraClearFlags = Camera.main.clearFlags; } }
private static AnimationInterface DrawBehaviourAnimationAnimationData(ICEWorldBehaviour _control, AnimationInterface _animation_data) { Animation _animation = _control.GetComponentInChildren <Animation>(); if (_animation != null && _animation.enabled == true) { Info.Help(Info.ANIMATION_ANIMATION); if (EditorApplication.isPlaying) { EditorGUILayout.LabelField("Name", _animation_data.Name); } else { string _animation_name = AnimationPopup(_animation, _animation_data.Name, "Animation (" + _animation_data.Length.ToString() + " secs.)", Info.ANIMATION_NAME); if (_animation_name != _animation_data.Name) { AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_name); if (_state != null) { if (_state.clip != null) { _state.clip.legacy = true; } _animation_data.TransitionDuration = 0.25f; _animation_data.wrapMode = _state.wrapMode; _animation_data.DefaultWrapMode = _state.wrapMode; _animation_data.Speed = _state.speed; _animation_data.DefaultSpeed = _state.speed; _animation_data.Name = _state.name; _animation_data.Length = _state.length; } } } EditorGUI.indentLevel++; _animation_data.wrapMode = DrawBehaviourAnimationWrapMode(_animation_data.wrapMode); DrawBehaviourAnimationData(ref _animation_data.Speed, ref _animation_data.AutoSpeed, ref _animation_data.TransitionDuration, ref _animation_data.AutoTransitionDuration, _animation_data.DefaultSpeed); if (_animation_data.AutoTransitionDuration) { _animation_data.TransitionDuration = _animation_data.Length / 3; } EditorGUI.indentLevel--; } else { EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning); } return(_animation_data); }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); Corpse.Init(OwnerComponent); Odour.Init(OwnerComponent); m_InitialDurability = Random.Range(InitialDurabilityMin, InitialDurabilityMax); m_Durability = m_InitialDurability; PrintDebugLog(this, "Init"); }
public void Start(ICEWorldBehaviour _component, GameObject _receiver) { if (_component == null || UseTrigger) { return; } base.Init(_component); m_Receiver = (_receiver == null ? Owner : _receiver); base.Start(); }
public void Action(ICEWorldBehaviour _component, GameObject _receiver) { if (_component == null) { return; } base.Init(_component); m_Receiver = (_receiver == null ? Owner : _receiver); SendMessage(Event); }
/// <summary> /// Start the event with the specified _component and _receiver. /// </summary> /// <param name="_component">Component.</param> /// <param name="_receiver">Receiver.</param> public void Start(ICEWorldBehaviour _component, GameObject _receiver) { if (!Enabled || _component == null) { return; } base.Init(_component); foreach (BehaviourEventObject _event in Events) { _event.Start(_component, _receiver); } }
public override void Init(ICEWorldBehaviour _component) { base.Init(_component); if (Source != null) { Source.rolloffMode = AudioRolloffMode.Logarithmic; Source.volume = 0.5f; Source.pitch = 1f; Source.minDistance = 10f; Source.maxDistance = 100f; Source.spatialBlend = 1f; } }
public void Stop(ICEWorldBehaviour _component) { InventoryObject _inventory = null; ICECreatureControl _control = _component as ICECreatureControl; if (_control != null) { _inventory = _control.Creature.Status.Inventory; } foreach (InventoryActionDataObject _action in ActionList) { _action.Stop(_inventory); } }
public static AnimationEventObject AnimationEventPopupLine(ICEWorldBehaviour _component, AnimationEventObject _event, BehaviourEventInfo[] _behaviour_events, ref bool _custom, string _help = "", string _title = "", string _hint = "") { if (_custom || _behaviour_events.Length == 0) { //_event.ComponentName = ""; _event.MethodName = ICEEditorLayout.Text(_title, _hint, _event.MethodName, ""); int indent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; _event.ParameterType = (AnimationEventParameterType)EditorGUILayout.EnumPopup(_event.ParameterType, GUILayout.Width(60)); EditorGUI.indentLevel = indent; _custom = true; } else { string[] _array = new string[_behaviour_events.Length + 1]; _array[0] = " "; for (int i = 0; i < _behaviour_events.Length; i++) { _array[i + 1] = _behaviour_events[i].Key; } int _selected = ICEEditorLayout.Popup(_title, _hint, EditorTools.StringToIndex(_component.name + "." + _event.MethodName, _array), _array, ""); if (_selected == 0) { _event.Reset(); } else { for (int i = 0; i < _behaviour_events.Length; i++) { if (_behaviour_events[i].Key == _array[_selected]) { _event.SetInfo(_behaviour_events[i]); } } } } EditorGUI.BeginDisabledGroup(_behaviour_events.Length == 0); _custom = ICEEditorLayout.CheckButtonMiddle("CUSTOM", "", _custom); EditorGUI.EndDisabledGroup(); return(_event); }