public void ExecuteOnTarget(HeroKitObject targetObject, string childName, int colliderType) { switch (colliderType) { case 2: // box BoxCollider2D boxCollider = targetObject.GetHeroChildComponent <BoxCollider2D>("BoxCollider2D", childName); if (boxCollider != null) { boxCollider.isTrigger = true; } break; case 3: // capsule CapsuleCollider2D capsuleCollider = targetObject.GetHeroChildComponent <CapsuleCollider2D>("CapsuleCollider2D", childName); if (capsuleCollider != null) { capsuleCollider.isTrigger = true; } break; case 4: // circle CircleCollider2D circleCollider = targetObject.GetHeroChildComponent <CircleCollider2D>("CircleCollider2D", childName); if (circleCollider != null) { circleCollider.isTrigger = true; } break; } }
// Use this for initialization void OnEnable() { HeroKitObject targetObject = this.GetComponent <HeroKitObject>(); animator = targetObject.GetHeroChildComponent <Animator>("Animator", HeroKitCommonRuntime.visualsName); rigidBody = GetComponent <Rigidbody2D>(); spriteRenderer = targetObject.GetHeroChildComponent <SpriteRenderer>("SpriteRenderer", HeroKitCommonRuntime.visualsName); visualsGO = transform.Find(HeroKitCommonRuntime.visualsName).gameObject; collisionLayers = Physics2D.GetLayerCollisionMask(gameObject.layer); contactFilter.useTriggers = false; contactFilter.SetLayerMask(collisionLayers); contactFilter.useLayerMask = true; enabled = false; }
public void ExecuteOnTarget(HeroKitObject targetObject, bool changeStartAnim, bool changeEndAnim) { // get the animator component Animator animator = targetObject.GetHeroChildComponent <Animator>("Animator", HeroKitCommonRuntime.visualsName); if (animator != null) { // get the movement script moveObject = targetObject.GetHeroComponent <HeroSettings2D>("HeroSettings2D", true); if (changeStartAnim) { moveObject.jumpBegin = AnimationParameterValue.GetValueA(heroKitObject, 3, 4, 5); } if (changeEndAnim) { moveObject.jumpEnd = AnimationParameterValue.GetValueA(heroKitObject, 7, 8, 9); } //// disable jump script if it is not being used //if (!moveObject.haveJumped) // moveObject.enabled = false; } }
public void ExecuteOnTarget(HeroKitObject targetObject, string childName) { Transform transform = null; if (childName == "") { transform = targetObject.transform; } else { transform = targetObject.GetHeroChildComponent <Transform>("Transform", childName); } if (transform != null) { Vector3 degrees = new Vector3(); // get the target rotation degrees.z = IntegerFieldValue.GetValueA(heroKitObject, 4); degreesToChange.z = degrees.z; // change the rotation transform.localEulerAngles = transform.localEulerAngles + degrees; } }
public void ExecuteOnTarget(HeroKitObject targetObject, string animationName, int index) { // get the animator component Animation animation = targetObject.GetHeroChildComponent <Animation>("Animation", HeroKitCommonRuntime.visualsName); animInfo[index].animation = animation; animInfo[index].name = animationName; }
// Gets objects in a scene that match a certerin criteria public int Execute(HeroKitObject hko) { // Get variables heroKitObject = hko; eventID = heroKitObject.heroStateData.eventBlock; int actionCount = heroKitObject.heroState.heroEvent[eventID].actions.Count; //----------------------------------------- // Get the game objects in the scene that match specific parameters //----------------------------------------- int actionType = DropDownListValue.GetValue(heroKitObject, 0); int getHeroFieldID = 1; int objectCount = IntegerFieldValue.GetValueA(heroKitObject, 2); HeroKitObject originHKO = HeroObjectFieldValue.GetValueA(heroKitObject, 3)[0]; List <HeroKitObject> listObjects = HeroObjectFieldValue.GetValueB(heroKitObject, 4); string childName = ChildObjectValue.GetValue(heroKitObject, 5, 6); int rayDirectionType = DropDownListValue.GetValue(heroKitObject, 7); int fieldOfView = IntegerFieldValue.GetValueA(heroKitObject, 8); // get origin object GameObject originObject = null; Transform transform = null; if (childName == "") { transform = originHKO.transform; } else { transform = originHKO.GetHeroChildComponent <Transform>("Transform", childName); } originObject = transform.gameObject; // convert list objects to array HeroKitObject[] arrayObjects = (listObjects != null) ? listObjects.ToArray() : null; // filter the hero kit objects in the scene List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsFOV(arrayObjects, objectCount, originObject, fieldOfView, rayDirectionType); // assign the hero kit objects to the list HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType); //----------------------------------------- // debugging stuff //----------------------------------------- if (heroKitObject.debugHeroObject) { string countStr = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString(); string name = (originObject != null) ? originObject.name : ""; string debugMessage = "Get objects in field of view of this object: " + name + "\n" + "Objects found: " + countStr; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } return(-99); }
public void ExecuteOnTarget(HeroKitObject targetObject, string animationName) { // get the animator component Animator animator = targetObject.GetHeroChildComponent <Animator>("Animator", HeroKitCommonRuntime.visualsName); // animate the target if (animator != null) { animator.SetBool(animationName, false); } }
public void ExecuteOnTarget(HeroKitObject targetObject, string animationName) { // get the animator component Animator animator = targetObject.GetHeroChildComponent <Animator>("Animator", HeroKitCommonRuntime.visualsName); if (animator != null) { // get the movement script moveObject = targetObject.GetHeroComponent <HeroMove3D>("HeroMove3D", true); moveObject.settings.moveDefault = animationName; } }
public void ExecuteOnTarget(HeroKitObject targetObject, int speed, int moveType, int animationType) { // get the movement script HeroSettings2D moveSettings = targetObject.GetHeroComponent <HeroSettings2D>("HeroSettings2D", true); moveSettings.animType = (HeroSettings2D.AnimType)(animationType - 1); moveSettings.moveType = (HeroSettings2D.MoveType)(moveType - 1); moveSettings.animator = targetObject.GetHeroChildComponent <Animator>("Animator", HeroKitCommonRuntime.visualsName); moveSettings.moveSpeed = speed; moveSettings.faceDir = HeroSettings2D.FaceDir.down; RpgController2D moveObject = targetObject.GetHeroComponent <RpgController2D>("RpgController2D", true); }
public void ExecuteOnTarget(HeroKitObject targetObject, string childName, int colliderType) { switch (colliderType) { case 2: // box BoxCollider boxCollider = targetObject.GetHeroChildComponent <BoxCollider>("BoxCollider", childName); if (boxCollider != null) { boxCollider.isTrigger = true; } break; case 3: // capsule CapsuleCollider capsuleCollider = targetObject.GetHeroChildComponent <CapsuleCollider>("CapsuleCollider", childName); if (capsuleCollider != null) { capsuleCollider.isTrigger = true; } break; case 4: // mesh MeshCollider meshCollider = targetObject.GetHeroChildComponent <MeshCollider>("MeshCollider", childName); if (meshCollider != null) { meshCollider.isTrigger = true; } break; case 5: // sphere SphereCollider sphereCollider = targetObject.GetHeroChildComponent <SphereCollider>("SphereCollider", childName); if (sphereCollider != null) { sphereCollider.isTrigger = true; } break; } }
public void ExecuteOnTarget(HeroKitObject targetObject, int speed, int moveType, int animationType, bool changeSpeed, bool changeMove, bool changeAnim) { HeroSettings2D moveSettings = targetObject.GetHeroComponent <HeroSettings2D>("HeroSettings2D", true); if (changeAnim) { moveSettings.animType = (HeroSettings2D.AnimType)(animationType - 1); } if (changeMove) { moveSettings.moveType = (HeroSettings2D.MoveType)(moveType - 1); } moveSettings.animator = targetObject.GetHeroChildComponent <Animator>("Animator", HeroKitCommonRuntime.visualsName); if (changeSpeed) { moveSettings.moveSpeed = speed; } }
public void ExecuteOnTarget(HeroKitObject targetObject, string childName) { Transform transform = null; if (childName == "") { transform = targetObject.transform; } else { transform = targetObject.GetHeroChildComponent <Transform>("Transform", childName); } Vector3 pos = transform.localPosition; // get the values to update bool changeX = BoolValue.GetValue(heroKitObject, 4); if (changeX) { pos.x = FloatFieldValue.GetValueA(heroKitObject, 5); position.x = pos.x; } bool changeY = BoolValue.GetValue(heroKitObject, 6); if (changeY) { pos.y = FloatFieldValue.GetValueA(heroKitObject, 7); position.y = pos.y; } bool changeZ = BoolValue.GetValue(heroKitObject, 8); if (changeZ) { pos.z = FloatFieldValue.GetValueA(heroKitObject, 9); position.z = pos.z; } // update the transform transform.localPosition = pos; }
public void ExecuteOnTarget(HeroKitObject targetObject, string childName) { Transform transform = null; if (childName == "") { transform = targetObject.transform; } else { transform = targetObject.GetHeroChildComponent <Transform>("Transform", childName); } if (transform != null) { Vector3 degrees = new Vector3(); // get the target rotation bool changeX = BoolValue.GetValue(heroKitObject, 4); if (changeX) { degrees.x = IntegerFieldValue.GetValueA(heroKitObject, 5); degreesToChange.x = degrees.x; } bool changeY = BoolValue.GetValue(heroKitObject, 6); if (changeY) { degrees.y = IntegerFieldValue.GetValueA(heroKitObject, 7); degreesToChange.y = degrees.y; } bool changeZ = BoolValue.GetValue(heroKitObject, 8); if (changeZ) { degrees.z = IntegerFieldValue.GetValueA(heroKitObject, 9); degreesToChange.z = degrees.z; } // change the rotation transform.localEulerAngles = transform.localEulerAngles + degrees; } }
// Gets objects in a scene that match a certerin criteria public int Execute(HeroKitObject hko) { // Get variables heroKitObject = hko; //----------------------------------------- // Get the game objects in the scene that match specific parameters //----------------------------------------- int actionType = DropDownListValue.GetValue(heroKitObject, 0); int getHeroFieldID = 1; int objectCount = IntegerFieldValue.GetValueA(heroKitObject, 2); int rayDirectionType = DropDownListValue.GetValue(heroKitObject, 4); float rayDistance = IntegerFieldValue.GetValueA(heroKitObject, 5) * 0.1f; int rayType = DropDownListValue.GetValue(heroKitObject, 6); bool debugRay = BoolValue.GetValue(heroKitObject, 9); GameObject originObject = null; HeroKitObject targetObject = null; // ray is on a specific camera if (rayType == 2) { targetObject = HeroObjectFieldValue.GetValueA(heroKitObject, 3)[0]; if (targetObject != null) { originObject = targetObject.gameObject; } } // ray is on hero object else if (rayType == 3) { targetObject = HeroObjectFieldValue.GetValueA(heroKitObject, 3)[0]; string childName = ChildObjectValue.GetValue(heroKitObject, 7, 8); Transform transform = null; if (childName == "") { transform = targetObject.transform; } else { transform = targetObject.GetHeroChildComponent <Transform>("Transform", childName); } originObject = transform.gameObject; } // filter the hero kit objects in the scene List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsRay2D(objectCount, targetObject, originObject, rayType, rayDirectionType, rayDistance, debugRay); // assign the hero kit objects to the list HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType); //----------------------------------------- // debugging stuff //----------------------------------------- if (heroKitObject.debugHeroObject) { string countStr = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString(); string debugMessage = "Maximum number of objects to get: " + objectCount + "\n" + "Objects found: " + countStr; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } return(-99); }