public override void DrawTask(Scene scene) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("TargetProp"); TargetProp = (Prop)EditorGUILayout.ObjectField(TargetProp, typeof(Prop), true); EditorGUILayout.EndHorizontal(); if (TargetProp == null) { EditorGUILayout.HelpBox($"TargetProp Cannot be empty", MessageType.Error); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Target Prop Holder"); TargetPropHolder = (PropHolder)EditorGUILayout.ObjectField(TargetPropHolder, typeof(PropHolder), true); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Target"); Target = (Transform)EditorGUILayout.ObjectField(Target, typeof(Transform), true); EditorGUILayout.EndHorizontal(); if (TargetPropHolder == null && Target == null) { EditorGUILayout.HelpBox($"both TargetPropHolder and Target are empty", MessageType.Error); } base.DrawTask(scene); }
public virtual void DropProp() { if (PropHolder == null) { Logger.LogError($"DropProp called with PropHolder == null"); return; } //find nearest prop holder PropHolder nearestPropHolder = null; float smallestDistance = float.MaxValue; foreach (var holder in PropHolder.PropHoldersList) { if (holder == PropHolder) { continue; } var distance = DistanceUtility.Get2d(transform, holder.transform); if (distance <= smallestDistance && holder.CanHoldProp(this, distance:distance)) { smallestDistance = distance; nearestPropHolder = holder; } } //remove prop from old prop holder PropHolder.RemoveProp(this); PropHolder = null; if (nearestPropHolder == null) { //set pos to scene prop root transform.parent = PlayerManger.MangerInstance.PropsRoot; transform.localEulerAngles = Vector3.zero; Rigidbody.isKinematic = false; Collider.enabled = true; SetRotateToCam(true); } else { PickUpProp(nearestPropHolder); } }
public virtual void PickUpProp(PropHolder propholder) { if (propholder == null) { Logger.LogError($"PickUpProp called with propHolder == null"); return; } if (PropHolder != null) { PropHolder.RemoveProp(this); } PropHolder = propholder; PropHolder.AddProp(this); Rigidbody.isKinematic = true; Collider.enabled = false; SetRotateToCam(false); }
/// <summary> /// Generates a money prop if missing. /// </summary> private void GenerateMoney(PropHolder holder) { if (holder.CurrentProp != null) { return; } GameObject newGO = (GameObject)GameObject.Instantiate(MoneyPrefab); Prop prop = newGO.GetComponent<Prop>(); this.HoldPropStorage.Attach(prop); }
/// <summary> /// Subtree to put an object to the given PropHolder, using the given InteractionObject /// for the IK. This subtree will not change state. Also, this subtree will not let the character /// approach the PropHolder, which should be done in another step. /// </summary> public Node ST_Put(PropHolder holder, InteractionObject put) { return new DecoratorCatch( () => { this.Character.StopInteraction(FullBodyBipedEffector.RightHand); this.Character.HeadLookStop(); }, new Sequence( this.ST_OrientAndReach(holder.transform.position, put), new LeafInvoke(() => holder.Attach(this.HoldPropRightHand.Release())), this.Node_HeadLookStop())); }
virtual public object GetValue(string Key) { return(PropHolder.GetValue(Key)); }
protected Node ST_Drop(SmartCharacter user, StateName holdingState, PropHolder holder) { return new Sequence( user.Node_Require(StateName.RoleActor, holdingState, StateName.IsStanding), this.Node_Require(StateName.RoleContainer, ~StateName.IsOccupied), new LeafInvoke(() => this.Holder.Attach(holder.Release())), this.Node_Set(holdingState, StateName.IsOccupied), user.Node_Set(~holdingState)); }
protected override void DeclareProperties() { base.DeclareProperties(); PropHolder.Add("Template", "Макет", m_Document); }