コード例 #1
0
    public void PerformThrowAttack(Throwable.Visual visual)
    {
        if (mState != State.PlayerInput)
        {
            return;
        }

        var character = mCharacters[mCurrentCharacter];

        mTargetCharacter = mEnemies[mSelectedEnemy].Character;

        Throwable throwable = Instantiate(ThrowablePrefab);

        throwable.SetVisual(visual);

        var projectile = throwable.gameObject.AddComponent <Projectile>();

        projectile.DeleteWhenDone = true;
        projectile.transform.SetParent(character.ThrowableShooter.transform, false);
        projectile.BeginAnimating(mTargetCharacter.transform.position, 0.5f);

        mThrownItem = visual;

        mThrowAttackTime = 0.5f;
        mState           = State.ThrowAttack;

        mUI.SetHudMode(UI.HudMode.Passive);
        UpdateSelectedEnemyVisual();
    }
コード例 #2
0
    protected override GameObject CreatePreviewObject()
    {
        GameObject go = null;

        try {
            mCurrentVisual = GetCurrentVisual();
            var prefab = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/Throwable.prefab", typeof(GameObject));
            go = (GameObject)Instantiate(prefab);
            go.GetComponent <Throwable>().SetVisual(mCurrentVisual);
        } catch (Exception e) {
            Debug.LogException(e);
        }
        return(go);
    }