public override void Activate(Tapestry_Entity activatingEntity) { if (!isOpening && !isClosing) { if (!security.isLocked) { if (isOpen) { Close(); } else { Open(); } } else { if (!isOpen && jiggleOnActivateWhenLocked) { emitter.clip = lockedSound; emitter.volume = Tapestry_Config.SoundVolumeMaster * Tapestry_Config.SoundVolumeSFX; emitter.Play(); isJiggling = true; time = 0; } } } }
public void UnbindEntity(Tapestry_Entity e) { hasBoundEntity = false; GetComponent <Rigidbody>().isKinematic = true; e.transform.SetParent(null); e.GetComponent <Rigidbody>().isKinematic = false; e.isPushing = false; }
public override void Push(Tapestry_Entity activatingEntity) { if (isPushable) { if (activatingEntity.isPushing && !isPushing) { UnbindEntity(activatingEntity); } else { BindEntityForPush(activatingEntity); } } base.Push(activatingEntity); }
public override void Activate(Tapestry_Entity activatingEntity) { if (isHarvestable) { int q = quantityMin; if (quantityMin != quantityMax) { q = Mathf.RoundToInt(quantityWeightCurve.Evaluate(Random.value) * (float)quantityMax) - quantityMin; } activatingEntity.inventory.AddItem(item, q); SetHarvestability(false); } //base.Activate(); }
public void BindEntityForPush(Tapestry_Entity e) { hasBoundEntity = true; GetComponent <Rigidbody>().isKinematic = false; e.GetComponent <Rigidbody>().isKinematic = true; e.transform.SetParent(this.transform); e.isPushing = true; GameObject closest = null; float shortestDist = float.MaxValue; foreach (GameObject point in GetAttachPoints()) { float thisDist = Vector3.Distance(point.transform.position, e.attachPoint.transform.position); if (thisDist < shortestDist) { closest = point; shortestDist = thisDist; } } e.transform.rotation = closest.transform.rotation; Vector3 offset = closest.transform.position - e.attachPoint.transform.position; e.transform.position = e.transform.position + offset; activeAttachPoint = closest; int score = e.attributeProfile.GetScore(Tapestry_Config.pushLiftAttribute); if (score > pushClumsy) { if (score > pushImpressive) { score = pushImpressive; } float prog = (float)(score - pushClumsy) / (float)(pushImpressive - pushClumsy); if (gridAligned) { pushSpeed = (pushSpeedCurve.Evaluate(prog) * (pushSpeedMax - pushSpeedMin)) + pushSpeedMin; } else { float min = Tapestry_Config.BaseEntityWalkSpeed * pushSpeedMin, max = Tapestry_Config.BaseEntityWalkSpeed * pushSpeedMax; pushSpeed = (pushSpeedCurve.Evaluate(prog) * (max - min)) + min; } } }
public override void Activate(Tapestry_Entity activatingEntity) { if (toggleOnActivate) { if (!isTurningOn && !isTurningOff) { if (isOn) { TurnOff(); } else { TurnOn(); } } } }
public override void Activate(Tapestry_Entity activatingEntity) { if (!fireOnlyOnce || (fireOnlyOnce && !hasFired)) { if (!isSwitchingOn && !isSwitchingOff) { if (isOn) { SwitchOff(); } else { SwitchOn(); } } } }
public override void Activate(Tapestry_Entity activatingEntity) { }
public override void Activate(Tapestry_Entity activatingEntity) { Destroy(this.gameObject); }
public virtual void Lift(Tapestry_Entity activatingEntity) { }
public virtual void Push(Tapestry_Entity activatingEntity) { }
public virtual void Activate(Tapestry_Entity activatingEntity) { }
public override void OnInspectorGUI() { Tapestry_Entity e = target as Tapestry_Entity; //DrawDefaultInspector(); //GUILayout.Box("BELOW IS CUSTOM INSPECTOR CODE"); GUILayout.BeginHorizontal(); //GUI.backgroundColor = new Color(0.9f, 1.0f, 0.9f); GUILayout.BeginVertical("box"); GUILayout.Label("Health (" + e.GetHealthState() + ")"); GUILayout.BeginHorizontal(); e.health = GUILayout.HorizontalSlider(e.health, 0, 1000); float.TryParse(GUILayout.TextField(e.health.ToString(), GUILayout.MaxWidth(40)), out e.health); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); GUILayout.Label("Stamina (" + e.GetStaminaState() + ")"); GUILayout.BeginHorizontal(); e.stamina = GUILayout.HorizontalSlider(e.stamina, 0, 1000); float.TryParse(GUILayout.TextField(e.stamina.ToString(), GUILayout.MaxWidth(40)), out e.stamina); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); if (e.attributeProfile == null) { e.attributeProfile = new Tapestry_AttributeProfile(); } string scoreTooltip = "Score: What the score starts at. Ranges from 0 to 100, but Effect can push above that cap."; string progTooltip = "Progress: How close the Entity is to a new rank. Generally only the player or followers are going to make use of this. A new rank occurs at 1000 Progress."; GUILayout.BeginHorizontal("box"); foreach (var v in Enum.GetValues(typeof(Tapestry_Attribute))) { Tapestry_Attribute val = (Tapestry_Attribute)v; GUILayout.BeginVertical("box"); GUILayout.Label(val.ToString()); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("S", scoreTooltip), GUILayout.Width(12)); e.attributeProfile.SetScore(val, EditorGUILayout.IntField(e.attributeProfile.GetScore(val), GUILayout.Width(32))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("P", progTooltip), GUILayout.Width(12)); e.attributeProfile.SetProgress(val, EditorGUILayout.FloatField(e.attributeProfile.GetProgress(val), GUILayout.Width(32))); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.EndHorizontal(); GUILayout.BeginVertical("box"); string asTooltip = "Multiplier to the animation speed of abilities. 1.0 is normal speed, low numbers are faster."; string chrTooltip = "Chance that an ability is critically effective. Maximum of 0.25."; string msTooltip = "Multiplier to character movement speed. 1.0 is normal speed, high numbers are faster."; string pseTooltip = "Cost multiplier to physical actions that cost Stamina. 1.0 is normal cost, low numbers make actions cheaper."; string mseTooltip = "Cost multiplier to mental actions that cost Stamina. 1.0 is normal cost, low numbers make actions cheaper."; GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Action Speed", asTooltip)); GUILayout.FlexibleSpace(); GUILayout.Label(String.Format("{0:0.##}", e.attributeProfile.ActionSpeed * 100.0f) + "%"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Critical Hit Rate", chrTooltip)); GUILayout.FlexibleSpace(); GUILayout.Label(String.Format("{0:0.##}", e.attributeProfile.CriticalHitRate * 100.0f) + "%"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Movement Speed", msTooltip)); GUILayout.FlexibleSpace(); GUILayout.Label(String.Format("{0:0.##}", e.attributeProfile.MovementSpeed * 100.0f) + "%"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Physical Stamina Costs", pseTooltip)); GUILayout.FlexibleSpace(); GUILayout.Label(String.Format("{0:0.##}", e.attributeProfile.PhysicalStaminaMult * 100.0f) + "%"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Mental Stamina Costs", mseTooltip)); GUILayout.FlexibleSpace(); GUILayout.Label(String.Format("{0:##}", e.attributeProfile.MentalStaminaMult * 100.0f) + "%"); GUILayout.EndHorizontal(); GUILayout.EndVertical(); toolbarActive = GUILayout.Toolbar(toolbarActive, toolbarNames); if (toolbarActive != -1) { if (toolbarNames[toolbarActive] == "Inventory") { if (ReferenceEquals(e.inventory, null)) { e.inventory = (Tapestry_Inventory)ScriptableObject.CreateInstance("Tapestry_Inventory"); } e.inventory.DrawInspector(); } if (toolbarNames[toolbarActive] == "Skills") { if (e.skillProfile == null) { e.skillProfile = new Tapestry_SkillProfile(); } GUILayout.BeginVertical("box"); foreach (var v in Enum.GetValues(typeof(Tapestry_Skill))) { Tapestry_Skill val = (Tapestry_Skill)v; GUILayout.BeginHorizontal(); GUILayout.Label(val.ToString(), GUILayout.Width(120)); GUILayout.FlexibleSpace(); GUILayout.Label(new GUIContent("Score:", scoreTooltip)); e.skillProfile.SetScore(val, EditorGUILayout.IntField(e.skillProfile.GetScore(val), GUILayout.Width(40))); GUILayout.FlexibleSpace(); GUILayout.Label(new GUIContent("Prog:", progTooltip)); e.skillProfile.SetProgress(val, EditorGUILayout.FloatField(e.skillProfile.GetProgress(val), GUILayout.Width(40))); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } if (toolbarNames[toolbarActive] == "Resist") { if (e.damageProfile == null) { e.damageProfile = new Tapestry_DamageProfile(); } e.damageProfile.DrawInspector(); } if (toolbarNames[toolbarActive] == "Other") { GUILayout.BeginVertical("box"); GUILayout.Label("Time"); GUILayout.BeginHorizontal("box"); string timeTooltip = "What time scale this entity operates at. 1.0 is normal time."; GUILayout.Label(new GUIContent("Factor", timeTooltip)); e.personalTimeFactor = EditorGUILayout.DelayedFloatField(e.personalTimeFactor); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (e.keywords == null) { e.keywords = (Tapestry_KeywordRegistry)ScriptableObject.CreateInstance("Tapestry_KeywordRegistry"); } e.keywords.DrawInspector(); } } }
public override void Activate(Tapestry_Entity activatingEntity) { //base.Activate(activatingEntity); }