예제 #1
0
    void ItemUseAnimation(Object returnToSender, Triggers currentUse, ItemSprites spriteInfo)
    {
        Sprite[] leftAnim;
        Sprite[] rightAnim;

        leftAnim  = currentUse.leftHandSprites;
        rightAnim = currentUse.rightHandSprites;

        leftHandAnim.PlayAnimation(leftAnim, attackFrameRate, currentUse.keyFrame, (() =>
        {
        }), (() =>
        {
            leftHandSpriteRenderer.sprite = spriteInfo.leftHandSprite;
        }));
        rightHandAnim.PlayAnimation(rightAnim, attackFrameRate, currentUse.keyFrame, (() =>
        {
            if (spriteInfo.wrapSwing)
            {
                if (rightHandSpriteRenderer.transform.position.x < transform.position.x && rightHandSpriteRenderer.transform.position.z > transform.position.z)
                {
                    rightHandSpriteRenderer.sortingOrder = 3;
                }
            }

            AnimationEventManager.ItemUseTrigger(returnToSender, currentUse);
        }), (() =>
        {
            rightHandSpriteRenderer.sortingOrder = 1;
            AnimationEventManager.ItemUseCompletion(transform);
            rightHandSpriteRenderer.sprite = spriteInfo.rightHandSprite;
        }));
    }
예제 #2
0
 private void StartCharge(Transform user, int useType, ItemSprites spriteInfo)
 {
     isCharging      = true;
     beginUseTime    = Time.time;
     lastMouseButton = useType;
     AnimationEventManager.ItemChargeStart(user, data.useTypes[useType].uses[useCount], data.itemSprites);
 }
예제 #3
0
 public static void ItemAnimationStop(Object sender, ItemSprites spriteInfo)
 {
     if (OnItemAnimationStop != null)
     {
         OnItemAnimationStop(sender, spriteInfo);
     }
 }
예제 #4
0
 public static void ItemUse(Object sender, Triggers trig, ItemSprites spriteInfo)
 {
     if (OnItemUse != null)
     {
         OnItemUse(sender, trig, spriteInfo);
     }
 }
예제 #5
0
 public static void ItemChargeStart(Object sender, Triggers trig, ItemSprites spriteInfo)
 {
     if (OnItemChargeStart != null)
     {
         OnItemChargeStart(sender, trig, spriteInfo);
     }
 }
예제 #6
0
 private void Halt(Object sender, Triggers use, ItemSprites spriteInfo)
 {
     if (transform == (Transform)sender && this != null)
     {
         moveHalted = true;
     }
 }
    public Dictionary <ItemType, ItemSprites> ConstructList()
    {
        Dictionary <ItemType, ItemSprites> list = new Dictionary <ItemType, ItemSprites>();

        for (var i = 0; i < itemTypes.Length; i++)
        {
            var sprite = new ItemSprites();
            sprite.Sprite      = itemSprites[i];;
            sprite.ItemType    = itemTypes[i];
            sprite.Description = itemDescriptions[i];
            list[itemTypes[i]] = sprite;
        }
        return(list);
    }
예제 #8
0
    void SetUpSprites()
    {
        // Check for Sprites before getting
        if (GM.GetSpriteSet(myGameItem.itemProperties.itemID) != null)
        {
            spriteSet = GM.GetSpriteSet(myGameItem.itemProperties.itemID);
        }

        if (myGameItem.itemProperties.itemType == ItemProperties.itemTypes.pot)
        {
            mainSprite.sprite = spriteSet.normalSprites[0];
        }
        else // If a pot with a plant, Pot is now secondary object. Use that to get pot sprite
        {
            mainSprite.sprite = GM.GetSpriteSet(myGameItem.basePotID).normalSprites[0];
        }
    }
예제 #9
0
    /// <summary>
    /// Overrides this item with a new Plant Game Item, keeping the pot sprite
    /// </summary>
    /// <param name="incomingPlantItem"></param>
    public void AddPlantToWorldPotItem(GameItem incomingPlantScriptable) // Called from GM
    {
        GameItem cloneOfIncomingPlantItem = MagicTools.DeepCopy <GameItem>(incomingPlantScriptable);

        cloneOfIncomingPlantItem.placedPointName = myGameItem.placedPointName;
        cloneOfIncomingPlantItem.placedPointX    = myGameItem.placedPointX;
        cloneOfIncomingPlantItem.placedPointY    = myGameItem.placedPointY;
        cloneOfIncomingPlantItem.placedPointZ    = myGameItem.placedPointZ;
        cloneOfIncomingPlantItem.basePotID       = myGameItem.itemProperties.itemID; // IMPORTANT. Allows loading of Pot Sprite on Game Re-Open

        secondaryGameItem = myGameItem;
        myGameItem        = cloneOfIncomingPlantItem;

        myGameItem.itemProperties.itemType = ItemProperties.itemTypes.potWithPlant;
        myGameItem.inWorld     = true;
        myGameItem.ageTimeMins = 0;

        // New Sprite Set for Plants
        spriteSet = GM.GetSpriteSet(myGameItem.itemProperties.itemID);

        StagePlanted();
    }
예제 #10
0
    void ItemCharge(Object sender, Triggers currentUse, ItemSprites spriteInfo)
    {
        Sprite[] leftAnim;
        Sprite[] rightAnim;

        ItemUses chargeUse      = (ItemUses)currentUse;
        float    chargeDuration = chargeUse.maxHoldTime - chargeUse.minHoldTime;

        leftAnim  = chargeUse.leftHandChargeSprites;
        rightAnim = chargeUse.rightHandChargeSprites;

        leftHandAnim.PlayAnimation(leftAnim, chargeDuration / leftAnim.Length, currentUse.keyFrame, (() =>
        {
        }), (() =>
        {
        }));
        rightHandAnim.PlayAnimation(rightAnim, chargeDuration / rightAnim.Length, currentUse.keyFrame, (() =>
        {
        }), (() =>
        {
        }));
    }
예제 #11
0
 void ItemAnimStop(Object sender, ItemSprites spriteInfo)
 {
     leftHandAnim.SetSprite(transform, spriteInfo.leftHandSprite);
     rightHandAnim.SetSprite(transform, spriteInfo.rightHandSprite);
     AnimationEventManager.ItemUseCompletion(transform);
 }
예제 #12
0
 private void Awake()
 {
     Instance = this;
 }