Пример #1
0
    protected override void Attack()
    {
        // spawn a shockwave on the panel to the left of this mettaur

        PanelController toTheLeft = battlefield.GetPanelRelativeTo(enemy.panelCurrentlyOn, Direction.left);

        Vector3 spawnPos = toTheLeft.transform.position;

        spawnPos.y = enemy.transform.position.y;

        // TODO: play an animation, make the shockwave spawn at the end of it

        // spawn the shockwave prefab and move it
        string     prefabPath      = "Prefabs/Attacks/Shockwave";
        GameObject shockwavePrefab = Resources.Load <GameObject>(prefabPath);

        GameObject shockWaveGo = MonoBehaviour.Instantiate <GameObject>(shockwavePrefab);

        shockWaveGo.transform.position = spawnPos;

        Shockwave shockwaveScript = shockWaveGo.GetComponent <Shockwave>();

        shockwaveScript.Init(enemy);
        shockwaveScript.moveSpeed = shockwaveSpeed;
        shockwaveScript.Move(Vector3.left);

        Debug.Log(enemy.name + " created a shockwave!");
        ResetAttackDelay();
        PassToNextMett();
    }
Пример #2
0
    /// <summary> Creates (or reuses) a shockwave GameObject </summary>
    /// <param name="_position"> Centre position </param>
    /// <param name="_color"> Ripple's colour </param>
    public void StartRipple(Vector3 _position, Color _color)
    {
        GameObject gameObj = RecyclePool.RetrieveOrCreate(RecyclePool.PoolTypes.Shockwave, shockwavePrefab);

        // Set position & rotation
        gameObj.transform.parent     = myTrans;
        gameObj.transform.position   = _position;
        gameObj.transform.localScale = Vector3.zero;

        // (Re)start popup animation
        Shockwave shockwaveScript = gameObj.GetComponent <Shockwave>();

        shockwaveScript.Init(_color);

        shockwaves.Add(shockwaveScript);
    }
Пример #3
0
    private void OnInputDown()
    {
        // Check if occupying piece is null and provide user feedback

        if (occupyingPlayer == null)
        {
            Shockwave shockwave = Instantiate(Services.Prefabs.Shockwave, transform.position, Quaternion.identity);
            shockwave.Init(Services.GameScene.currentPlayer, transform.position);
            SetOccupyingPlayer(Services.GameScene.currentPlayer);
            Services.EventManager.Fire(new PlayMadeEvent(occupyingPlayer, this));
            float pitch = occupyingPlayer.playerNum == 0 ? 0.8f : 2f;
            Services.AudioManager.CreateTrackAndPlay(Clips.PLACE, pitch);
        }

        Services.EventManager.Register <TouchUp>(OnTouchUp);
        Services.EventManager.Register <MouseUp>(OnMouseUp);

        Services.EventManager.Unregister <TouchDown>(OnTouchDown);
        Services.EventManager.Unregister <MouseDown>(OnMouseDown);
    }