コード例 #1
0
ファイル: GoalZone.cs プロジェクト: PlipPlopTeam/RaccoonSquad
    void Absorb(Grabbable grabbable)
    {
        // ABSORB
        grabbable.GetProp().rigidbody.isKinematic = true;
        grabbable.GetProp().collider.enabled = false;

        AbsorbedObject ao = new AbsorbedObject();

        ao.obj           = grabbable.gameObject;
        ao.startPosition = grabbable.transform.position;
        ao.startSize     = grabbable.transform.localScale;
        absorbedObjects.Add(ao);

        SoundPlayer.PlayWithRandomPitch("fb_scoring_loot", 0.3f);
        if (!GameManager.instance.IsInGame())
        {
            var action = grabbable.GetComponent <ActionCube>();
            if (action != null)
            {
                switch (action.action)
                {
                case "startGame": GameManager.instance.NextLevel(); break;

                case "levelEditor": GameManager.instance.GoToLevelEditor(); break;

                case "saveLevel": GameManager.instance.SaveLevelWindow(); Instantiate(Library.instance.editorSaveLevelCube, new Vector3(), Quaternion.identity); break;
                }
            }
        }
        else if (GameManager.instance.IsInGame())
        {
            GameManager.instance.level.Score(grabbable);
            OnScoreChange();
        }
        Destroy(grabbable);
    }