예제 #1
0
    public override void Use()
    {
        if (objectToShoot == null)
        {
            return;
        }
        if (shootLocations.Count <= 0)
        {
            return;
        }

        //logic
        for (int i = 0; i < shootLocations.Count; i++)
        {
            //for all the locations we want to instantiate a slash.
            GameObject obj   = Instantiate(objectToShoot);
            Transform  trans = shootLocations[i].transform;
            obj.transform.position = trans.position;

            ThrowObject throwObjectComponent = obj.AddComponent <ThrowObject>();
            throwObjectComponent.Instantiate(Random.Range(minDamage, maxDamage), true, null);

            TweenBuild tweenBuild    = new TweenBuild(obj);
            Tween      tweenPosition = tweenBuild.SetTweenPosition(shootLocations[i].position + (shootLocations[i].forward * maxDistance), .4f, EasingType.Linear);

            tweenBuild.DestroyOnFinish = true;
            tweenBuild.StartTween();
        }
    }
예제 #2
0
    public override void Use()
    {
        if (throwObject == null)
        {
            return;
        }

        GameObject obj   = Instantiate(throwObject);
        Transform  trans = throwFromLocation.transform;

        obj.transform.position = trans.position + (trans.forward * forwardOffset);

        //FIX OBJECT SCRIPT
        ThrowObject throwObjectComponent = obj.AddComponent <ThrowObject>();

        throwObjectComponent.Instantiate(Random.Range(minDamage, maxDamage), true, null);

        TweenBuild tweenBuild    = new TweenBuild(obj);
        Tween      tweenPosition = tweenBuild.SetTweenPosition(throwFromLocation.position + (throwFromLocation.forward * maxDistance), speed, EasingType.Linear);

        tweenBuild.DestroyOnFinish = true;
        tweenBuild.StartTween();
    }