Пример #1
0
        /*
         * // bypass the creation of the status effect and just make its visual prefab
         * public void RawCast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput) {
         *  base.Cast(source, target, originalTarget, abilityEffectInput);
         * }
         */

        public override Dictionary <PrefabProfile, GameObject> Cast(BaseCharacter source, GameObject target, GameObject originalTarget, AbilityEffectOutput abilityEffectInput)
        {
            //Debug.Log("StatusEffect.Cast(" + source.name + ", " + (target? target.name : "null") + ")");
            if (!CanUseOn(target, source))
            {
                return(null);
            }
            Dictionary <PrefabProfile, GameObject> returnObjects = base.Cast(source, target, originalTarget, abilityEffectInput);
            PrefabProfile prefabProfile       = returnObjects.Keys.ElementAt(0);
            GameObject    abilityEffectObject = returnObjects[prefabProfile];

            GameObject go = prefabObjects.Values.ElementAt(0);

            if (abilityEffectObject != null)
            {
                // pass in the ability effect object so we can independently destroy it and let it last as long as the status effect (which could be refreshed).
                abilityEffectObject.transform.parent = PlayerManager.MyInstance.MyPlayerUnitParent.transform;

                dynamicCharacterAvatar = go.GetComponent <DynamicCharacterAvatar>();
                if (dynamicCharacterAvatar != null)
                {
                    SubscribeToUMACreate();
                }
                else
                {
                    HandleMountUnitSpawn();
                }
            }
            return(returnObjects);
        }
Пример #2
0
 public PrefabProfile GetNewResource(string resourceName)
 {
     //Debug.Log(this.GetType().Name + ".GetResource(" + resourceName + ")");
     if (!RequestIsEmpty(resourceName))
     {
         string keyName = prepareStringForMatch(resourceName);
         if (resourceList.ContainsKey(keyName))
         {
             PrefabProfile returnValue = ScriptableObject.Instantiate(resourceList[keyName]) as PrefabProfile;
             returnValue.SetupScriptableObjects();
             return(returnValue);
         }
     }
     return(null);
 }
Пример #3
0
        private void HandleMountUnitSpawn()
        {
            PrefabProfile prefabProfile       = prefabObjects.Keys.ElementAt(0);
            GameObject    abilityEffectObject = prefabObjects[prefabProfile];

            string originalPrefabSourceBone = prefabProfile.MyTargetBone;
            // NOTE: mount effects used sheathed position for character position.  do not use regular position to avoid putting mount below ground when spawning
            Vector3 originalPrefabOffset = prefabProfile.MySheathedPosition;

            if (originalPrefabSourceBone != null && originalPrefabSourceBone != string.Empty)
            {
                Transform mountPoint = abilityEffectObject.transform.FindChildByRecursive(originalPrefabSourceBone);
                if (mountPoint != null)
                {
                    PlayerManager.MyInstance.MyPlayerUnitObject.transform.parent = mountPoint;
                    //PlayerManager.MyInstance.MyPlayerUnitObject.transform.localPosition = Vector3.zero;
                    PlayerManager.MyInstance.MyPlayerUnitObject.transform.position = mountPoint.transform.TransformPoint(originalPrefabOffset);
                    ActivateMountedState();
                }
            }
        }