Exemplo n.º 1
0
 public void CollapseActions()
 {
     PlayerPrefsHelper.SaveBool("/AP/" + CurrentActionPoint.Data.Id + "/actionsCollapsed", true);
     CurrentActionPoint.ActionsCollapsed = true;
     CurrentActionPoint.UpdatePositionsOfPucks();
     CollapseBtn.gameObject.SetActive(false);
     ExpandBtn.gameObject.SetActive(true);
 }
Exemplo n.º 2
0
        public Action SpawnAction(string action_id, string action_name, string action_type, ActionPoint ap, IActionProvider actionProvider)
        {
            Debug.Assert(!ActionsContainsName(action_name));
            ActionMetadata actionMetadata;

            try {
                actionMetadata = actionProvider.GetActionMetadata(action_type);
            } catch (ItemNotFoundException ex) {
                Debug.LogError(ex);
                return(null); //TODO: throw exception
            }

            if (actionMetadata == null)
            {
                Debug.LogError("Actions not ready");
                return(null); //TODO: throw exception
            }
            GameObject puck = Instantiate(PuckPrefab, ap.ActionsSpawn.transform);

            puck.SetActive(false);

            puck.GetComponent <Action>().Init(action_id, action_name, actionMetadata, ap, actionProvider);

            puck.transform.localScale = new Vector3(1f, 1f, 1f);

            Action action = puck.GetComponent <Action>();

            // Add new action into scene reference
            ActionPoints[ap.Data.Id].Actions.Add(action_id, action);

            ap.UpdatePositionsOfPucks();
            puck.SetActive(true);

            return(action);
        }