void Awake()
 {
     characterSwapScript = GetComponent<CharacterSwap>();
     movementScript = GetComponent<Movement>();
     attack = GetComponentsInChildren<IAttack>();
     special = GetComponentsInChildren<ISpecial>();
 }
    /// <summary>
    /// Checks if the object is pickable.
    /// </summary>
    /// <returns><c>true</c>, if if pickable was checked, <c>false</c> otherwise.</returns>
    protected override bool CheckIfPickable()
    {
        // if what's colliding with the coin ain't a characterBehavior, we do nothing and exit
        _character = _pickingCollider.GetComponent <Character>();
        if (_character == null)
        {
            return(false);
        }

        if (_itemPicker != null)
        {
            if (!_itemPicker.Pickable())
            {
                return(false);
            }
        }

        CharacterSwap characterSwap = _pickingCollider.gameObject.MMGetComponentNoAlloc <CharacterSwap>();

        if (characterSwap == null)
        {
            return(false);
        }

        return(characterSwap.Order == OderPlayerType);
    }
Exemple #3
0
    private void Update()
    {
        if (characterSwapInstance != null && characterSwapInstance != this)
        {
            //Deletes the Script if another instance of the Character Swap already exist
            Destroy(this);
            return;
        }

        characterSwapInstance = this;

        Camera.main.transform.position = Vector2.Lerp(Camera.main.transform.position, allCharacters[index].transform.position, 0.125f);
        Camera.main.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, -10);

        if (!levelComplete)
        {
            // Looking for input
            if (Input.GetKeyDown(foward))
            {
                index++;
                SwitchCharacter(index);
                Debug.Log("Index = " + index);
            }

            if (Input.GetKeyDown(back))
            {
                index--;
                SwitchCharacter(index);
            }
        }
    }
 void Awake()
 {
     audioSource = GetComponents<AudioSource> ();
     movement = GetComponentInParent<Movement>();
     rigidbodyparent = GetComponentInParent<Rigidbody2D>();
     characterSwap = GetComponentInParent<CharacterSwap>();
     animations = GetComponents<PlayAnimation>();
 }
 void Awake()
 {
     characterSwap = GetComponent<CharacterSwap>();
     theRigidbody = GetComponent<Rigidbody2D>();
     if (tag == "Player") {
         animationScripts = GetComponentsInChildren<PlayAnimation>();
         idle = GetComponentsInChildren<Idle>();
     }
 }
Exemple #6
0
    protected override bool CheckConditions(GameObject collider)
    {
        CharacterSwap characterSwap = collider.gameObject.MMGetComponentNoAlloc <CharacterSwap>();

        if (characterSwap == null)
        {
            return(false);
        }

        return(characterSwap.Order == OderPlayerType &&
               StickmanManager.Instance.HasKey(OderPlayerType) &&
               base.CheckConditions(collider));
    }
        public void CharacterSwapFourthTest()
        {
            string input = "";

            Assert.AreEqual("", CharacterSwap.Vowel2Index(input));
        }
        public void CharacterSwapThirdTest()
        {
            string input = "Tomorrow is going to be raining";

            Assert.AreEqual("T2m4rr7w 10s g1415ng t20 b23 r2627n29ng", CharacterSwap.Vowel2Index(input));
        }
        public void CharacterSwapSecondTest()
        {
            string input = "Codewars is the best site in the world";

            Assert.AreEqual("C2d4w6rs 10s th15 b18st s23t25 27n th32 w35rld", CharacterSwap.Vowel2Index(input));
        }
Exemple #10
0
        public void CharacterSwapFirstTest()
        {
            string input = "this is my string";

            Assert.AreEqual("th3s 6s my str15ng", CharacterSwap.Vowel2Index(input));
        }
Exemple #11
0
 // Start is called before the first frame update
 void Start()
 {
     AudioManager.instance.PlaySound("Music_Gameplay");
     characterManager  = FindObjectOfType <CharacterSwap>();
     levelNumText.text = "Escape Attempt # " + levelNum;
 }
 void Awake()
 {
     Instance       = this;
     mySprite       = character.GetComponent <SpriteRenderer>();
     CharactersSwap = FindObjectOfType <CharacterSwap>();
 }