コード例 #1
0
    protected override void OnRabitHit(RabbitController rabit)
    {
        animateController = rabit.gameObject.GetComponent <AnimateController>();
        RabbitStats stats = rabit.gameObject.GetComponent <RabbitStats>();

        if (stats.isDead)
        {
            return;
        }

        if (rabit.isVulnerable)
        {
            CollectedHide();
            if (stats.rabbitSize == 0)
            {
                stats.isDead = true;
                die();
            }
            else
            {
                stats.rabbitSize = 0;
                makeRabbitSmaller(rabit);
                rabit.isVulnerable = false;
                rabit.gameObject.GetComponent <FlashObject>().startBlinking();
            }
        }
    }
コード例 #2
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        //Намагаємося отримати компонент кролика
        RabbitController rabit = collider.GetComponent <RabbitController>();

        //Впасти міг не тільки кролик
        if (rabit == null)
        {
            return;
        }

        animateController = rabit.gameObject.GetComponent <AnimateController>();
        RabbitStats stats = rabit.gameObject.GetComponent <RabbitStats>();

        if (rabit.isVulnerable)
        {
            if (stats.rabbitSize == 0)
            {
                die();
            }
            else
            {
                stats.rabbitSize = 0;
                makeRabbitSmaller(rabit);
                rabit.isVulnerable = false;
                rabit.gameObject.GetComponent <FlashObject>().startBlinking();
            }
        }
    }
コード例 #3
0
 private void initEverythingBeforehand()
 {
     rabbitStats       = LevelController.getRabbit().GetComponent <RabbitStats>();
     animateController = LevelController.getRabbit().GetComponent <AnimateController>();
     rabbitController  = LevelController.getRabbit().GetComponent <RabbitController>();
     base.attacking    = false;
     base.running      = false;
 }
コード例 #4
0
ファイル: Torch.cs プロジェクト: fewq/sutd-game-dev
 // Start is called before the first frame update
 void Start()
 {
     monsterNames         = new List <string>();
     attractedMonsters    = new List <MonsterController>();
     flameRenderer        = GetComponent <SpriteRenderer>();
     flameAniController   = GetComponent <AnimateController>();
     flameAnimator        = GetComponent <Animator>();
     transform.localScale = GameManager.Instance.gridScale;
 }
コード例 #5
0
    void Start()
    {
        sound                = GameObject.Find("SoundObjects").GetComponent <SoundController>();
        golightRenderer      = golight.GetComponent <Renderer>() as SpriteRenderer;
        golightAniController = golight.GetComponent <AnimateController>();
        // check launcher object exists
        GameObject launcherObj = GameObject.Find("Plunger-springjoint");

        if (launcherObj != null)
        {
            launcherScript = launcherObj.GetComponent <Launcher>();
        }
    }
コード例 #6
0
    void Start()
    {
        // animation object
        thisRenderer  = curveLampLightObj.GetComponent <Renderer>() as SpriteRenderer;
        aniController = curveLampLightObj.GetComponent <AnimateController>();
        // get scoreboard object
        GameObject obj = GameObject.Find("scoreText");

        if (obj != null)
        {
            scoreBoard = obj.GetComponent <ScoreBoard>();
        }
    }
コード例 #7
0
ファイル: Floatpiece.cs プロジェクト: gicabral/BossFinal
    void Start()
    {
        // Get scoreboard and sound object
        GameObject obj = GameObject.Find("scoreText");

        scoreBoard = obj.GetComponent <ScoreBoard>();
        sound      = GameObject.Find("SoundObjects").GetComponent <SoundController>();
        // Animation objects
        handcamRenderer      = handcamObj.GetComponent <Renderer>() as SpriteRenderer;
        golightRenderer      = golightObj.GetComponent <Renderer>() as SpriteRenderer;
        handcamAniController = handcamObj.GetComponent <AnimateController>();
        golightAniController = golightObj.GetComponent <AnimateController>();
        effect = GetComponent <BuoyancyEffector2D>();
    }
コード例 #8
0
    void Start()
    {
        // zoom animation object
        efxZoomAniController  = efxZoomObj.GetComponent <AnimateController>();
        efxLightAniController = efxLightObj.GetComponent <AnimateController>();
        // zoom light object
        efxZoomRenderer  = efxZoomObj.GetComponent <Renderer>() as SpriteRenderer;
        efxLightRenderer = efxLightObj.GetComponent <Renderer>() as SpriteRenderer;
        // sounds
        sounds     = GameObject.Find("SoundObjects").GetComponent <SoundController>();
        pullSound  = sounds.pulldown;
        shootSound = sounds.zonar;

        springJoint          = GetComponent <SpringJoint2D>();
        springJoint.distance = 1f;
    }
コード例 #9
0
    // Use this for initialization
    void Start()
    {
        shouldPlayFallSound  = false;
        isVulnerable         = true;
        invulnerabilityTime  = 4f;
        _invulnerabilityTime = invulnerabilityTime;

        myBody            = this.GetComponent <Rigidbody2D>();
        animateController = this.GetComponent <AnimateController>();
        spriteRenderer    = this.GetComponent <SpriteRenderer>();

        LevelController.current.setStartPosition(transform.position);

        this.parent = this.transform.parent;

        Physics2D.IgnoreLayerCollision(12, 10, true);
    }
コード例 #10
0
 // Use this for initialization
 void Start()
 {
     animateController = GetComponent <AnimateController>();
     thisRenderer      = GetComponent <Renderer>() as SpriteRenderer;
     sound             = GetComponent <AudioSource>();
 }