Beispiel #1
0
    public void LaunchItem(Vector3 startingLocation, Sprite icon, LaunchTargetLocationEnum target = LaunchTargetLocationEnum.Default, Action onFinishCallback = null)
    {
        var launchTarget = GetLaunchTarget(target);
        // animate icon going to animal
        var newEffect = flyingItemPrefab.Get <MoveToTargetAndFade>(startingLocation, Quaternion.identity, effectsCanvas.gameObject);

        newEffect.GetComponentInChildren <Image>().sprite = icon;
        newEffect.SetTarget(launchTarget.transform.position);
        newEffect.StartMoving(onFinishCallback);

        activeEffects.Add(newEffect);
    }
Beispiel #2
0
    private RectTransform GetLaunchTarget(LaunchTargetLocationEnum target)
    {
        switch (target)
        {
        case LaunchTargetLocationEnum.Gold:
            return(goldTarget);

        case LaunchTargetLocationEnum.Weight:
            return(weightTarget);

        case LaunchTargetLocationEnum.Default:
        case LaunchTargetLocationEnum.Animal:
        default:
            return(centerScreenTarget);
        }
    }