void GotInput(Inputs element) { this.elements.Add(element); if (this.elements.Contains(Inputs.ATTACK)) { AttackTypes type = this.GetAttackType(); ComputerInput.SendToAll <AttackTypes>("DoAttack", type); this.elements = new HashSet <Inputs>(); } }
public void Start() { diggingMode = DiggingMode.NotDigging; mouseMode = InputEnabled.Disabled; computerInputMode = InputEnabled.Disabled; computerInput = FindObjectOfType <ComputerInput>(); computerInput.gameObject.SetActive(false); deviceInputMode = InputEnabled.Disabled; deviceInput = FindObjectOfType <DeviceInput>(); deviceInput.gameObject.SetActive(false); }
// Start is called before the first frame update void Start() { state = GameState.START; MatchEndScreen.lossReason = LossReason.NA; pFieldTransforms = new Transform[10]; cFieldTransforms = new Transform[10]; playerDeckIndicator = GetComponent <ParticleSystem>(); computerDeckIndicator = GameObject.Find("ComputerDeckIndicator").GetComponent <ParticleSystem>(); playerScoreKeeper = FindObjectOfType <PlayerScoreKeeper>(); computerScoreKeeper = FindObjectOfType <ComputerScoreKeeper>(); prevSpriteRenderer = GetComponent <SpriteRenderer>(); computerInput = GetComponent <ComputerInput>(); cardFlipper = GetComponent <CardFlipper>(); audioManager = GetComponent <AudioManager>(); sFX = FindObjectOfType <SFX>(); uiButtons = GetComponent <UIButtons>(); matchEndScreen = GetComponent <MatchEndScreen>(); FindObjectOfType <AudioManager>().Play("Music"); Play(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Q)) { ComputerInput.SendToAll<Inputs>("GotInput", Inputs.FIRE); } else if (Input.GetKeyDown(KeyCode.W)) { ComputerInput.SendToAll<Inputs>("GotInput", Inputs.EARTH); } else if(Input.GetKeyDown(KeyCode.E)) { ComputerInput.SendToAll<Inputs>("GotInput", Inputs.LIGHTNING); } else if (Input.GetKeyDown(KeyCode.R)) { ComputerInput.SendToAll<Inputs>("GotInput", Inputs.WATER); } else if(Input.GetKeyDown(KeyCode.Space)) { ComputerInput.SendToAll<Inputs>("GotInput", Inputs.ATTACK); } }